I will explain how to treat repeating containers as a separate independent model. By doing this, you can conduct a search with the item skewered.
We will make it possible to manipulate the repetitive container "Breakdown" included in the "Quote" model as a separate model "Quotation item". Figure 1 shows the image.
Repetitive containers are separate tables on the database, and table names are decided by the following rule.
Model ID + "$" + Container ID
Figure 2 shows the repeat container of the estimate model.
The search screen of the added "quotation item" model is shown in Fig.Repeat container parts can be searched as data.
Fig. 4 shows the list screen of the "quotation item" model.The contents are the same as in Fig. 1.
Figure 5 shows an "estimate" model that defines repeating containers.
Figure 6 shows the repetitive container part of the red frame in Figure 5 extracted and defined as the "quotation item" model.
The points of definition are as follows.
Figure 7 shows the setting of using the repeated container ID "precordjshid" as the primary key.We do not use the order.
Open "Screen> Other> Database Details" of the quotation item model.Invalidate "Create table" and specify "physical table name" directly as "quotation $ precord".Furthermore, cancel "Enable Cache".
Please do not register, update, or delete the "quotation item" model prepared as a separate model.It is assumed to operate with reference only.(Data input is performed only in the original "quote" model.)
In the above explanation, "I will not create an update screen", but the reason is as follows.
I will show you how to avoid this problem.
Invalidate the cache on each of the original model ("estimate" in the example above) and the repeating container-independent model ("estimate line" in the example above).Performance is disadvantageous.
For example, prepare a control flag in the quotation.By this flag value, prepare a button display control expression to invalidate one update button, avoiding simultaneous update.
Adjust the lock key of the repeating container-independent model ("estimate item" in the example above) to the original model ("estimate" in the example above).In this case, it is impossible to control the locking of each individual record unit of the repeated container independent model.(It is because it becomes one lock key in the whole repeated container row.)
The following warning may be output to system.log and initdb.log.
Invocation of init method failed; nested exception is org.hibernate.MappingException: Foreign key (...) must have same number of columns as the referenced primary key (...)
If this Exception occurs, the definition of the primary key may be incorrect.Please review the definition of the primary key.