This is the second post describing several new features in the 2.6 version of LiveCycle Data Services– I will present several features that are related to managed associations.
In the current version several new parameters were introduced: read-only, load-on-demand, page-size, paged-collection and paged-updates.
The first one should be used for bidirectional relationships and it has the same meaning as setting inverse=”true” for a Hibernate association (the assembler will use only the other side of the relation in order to take modifications into account).
The other ones are used to improve the performance of managed associations. In the previous version you could improve it in several cases by using the “lazy” parameter. When set to true and applied to a one-to-one, one-to-many, or many-to-many association the client, by default, will load by default only the ID of the objects – the whole object will be loaded only when it is accessed for the first time. This can improve performance, but if you have a large collection you will still have to load a lot of information from the database to obtain all the ID’s and send them to the client
The new parameters remove this limitation. When you set load-on-demand for an association no values are sent to the client until the first time the association is accessed (it has the same effect as the lazy parameter for Hibernate managed collection). The page-size and paged-collection parameters are used to implement page-by-page fetching from the database/server – very important for large sets. The last one, paged-updates, controls the way in which the modifications from the client are sent to the server. If the value is false the entire collection is sent when some objects are removed or added, if true only the ID’s of these objects are send to the server. This parameter is automatically set to true if also page-size is set to true.
The effect of these parameters can be noticed especially when working with large collection – I performed some tests with a collection that has about 50000 elements (loaded in a datagrid) and it worked smoothly.