I plan to write some posts describing what’s new in LiveCycle Data Services 2.6 compared with the previous version (2.5.1) and also to provide some examples. There are some important new features that affect both productivity and performance
Today I will describe two of them: hibernate annotations and the automatic creation of associated destination
First, you can now use hibernate annotations because a new type of assembler was introduced – HibernateAnnotationsAssembler. This assembler extends HibernateAssembler and it has only one supplementary method – createHibernateConfiguration, which knows to create a Configuration class from the annotations.
In order to use the annotations the following steps should be followed:
a)Declare annotations for the persisted objects
b)Change Hibernate configuration files in order to use <mapping class=”class name”/> instead of <mapping resource=”resource name” />
c)Change the assembler for a destination from HibernateAssembler to HibernateAnnotationsAssembler
d)Add the following entry to the destination configuration:
The second one: Now it is possible to create automatically associated destinations as long as the destinations you are directly using for are defined in the data-management-config.xml. Also you can skip the identity tag for a destination and then it will be automatically generated taking into account the corresponding annotations. The big advantage of this is that now you can create and manage your destinations faster. The disadvantage is that if you do not want to configure any metadata you can lose performance (for example if you do not specify load-on–demand for a large set).
Another important point is that you cannot use the automatically created destinations for fill operations – if you want to do that you will have to add an explicit destination declaration for them into data-management-config.xml.
Below is an example of data-management-config.xml which uses the new way of declaring destinations:
I do not declare the identity of the test.Company destination – also I do not declare the destination test.Product. The last one will be automatically generated taking into consideration the hibernate annotations.
Note: it is possible completely omit the metadata section but I wanted to configure several parameters (lazy, paged-collection) in order to improve performance.