LiveCycle Data Services and Hibernate one-to-many association

I’ve noticed that several peoples have problems implementing one-to-many associations so I decided to write a simple example (using HibernateAnnotationsAssembler). It contains several use cases of working with this kind of association (more than the samples provided with LCDS distribution):

  • you can modify (update, add, delete) a parent or a child and see the synchronization between several clients. Note that when deleting the parent I have to programmatically delete the children’s – cascade on delete does not work yet automatically
  • you can create a parent and a child in the same transaction (no need to create the parent and save it before adding the children)
  • you can revert your modifications
  • conflict management should work both for parents and children
  • you can check the generated SQL in the server console (I’ve tested with MySQL database) and see the effect of the load-on-demand and page-size attributes).
  • you can check what happens when cache-items is set to true and when it is set to false

Note: I’ve mapped the one-to-many association as bidirectional (The parent has a list of children and a child has a reference to the parent). However if you have a large number of children associated with a parent, then from a performance point of view it is better to drop the list from the parent)

Also because the association is bidirectional I had to add the read-only attribute for the list of children (to notify the dataservice that it should look for updates only at the other end). If you will set the value to “false” you will see some strange SQL commands.

I’ve used Java 1.5 and Hibernate annotations so there is really not much code. You can download it from here (it’s an archive containing a Flex project and a readme.txt).

2 Responses to “LiveCycle Data Services and Hibernate one-to-many association”

  1. Matt Says:

    That zip file doesn’t seem to exist.

    “Sorry, but you are looking for something that isn’t here.”

  2. cornel Says:

    It works now - thanks for letting me know.

Leave a Reply