Something really isn't clicking here.
I have a web service and a sevice client that both use the same core jar lib. In the core, I have data transfer objects and hibernate mapping XML definitions for server, address book, user, and group information.
When the client queries for a server object including the address book, users, and groups, everything works fine. I get all the data using non-lazy loading <set> relationships.
When saving this in the client application database using hibernate, I can save the server object using:
session.save(serverDto);
However the above throws an error. The server object INSERT's fine, but hibernate is attempting to UPDATE the child objects, namely address book. This of course fails with an object sync error.
I've tried various solutions, but nothing seems to be the "right" way. I need to:
- Get the DTO data.
- Save the DTO data.
- Use the DTO data and relationships to make a JTree model.
When I save a parent object, I have to set the parent's collections to NULL, such as serverDto.setAddressBooks(null). Then I can save server without Hibernate trying to update the address book record. However I need this relationship for the JTree model building.
Any help would be greatly, greatly appreciated.
|