LiveCycle Data Services 2.6 – new features

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:

<item-class>class name</item-class>

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:

<?xml version="1.0" encoding="UTF-8"?>
<service id="data-service"
    class="flex.data.DataService">
    <adapters>
        <adapter-definition id="java-dao" class="flex.data.adapters.JavaAdapter" default="true"/>
    </adapters>
    <default-channels>
        <channel ref="my-rtmp" />
    </default-channels>
    <destination id="test.Company" channels="my-rtmp">
        <properties>
            <source>flex.data.assemblers.HibernateAnnotationsAssembler</source>
            <scope>application</scope>
            <item-class>test.Company</item-class>
            <metadata>
                <one-to-many property="products" destination="test.Product" read-only="true" page-size="20" paged-collection="true" lazy="false" />
            </metadata>
            <server>
                <hibernate-entity>test.Company</hibernate-entity>
            </server>
        </properties>
    </destination>
</service>

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.

One thought on “LiveCycle Data Services 2.6 – new features

  1. Pingback: LiveCycle Data Services 2.6 - new features : Mihai CORLAN

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>