I have a SWING desktop client and web application server, both of which are using Hibernate at both ends. I would like to reuse domain objects and mappings for both when I just need to "replicate" data from other to the other. For example, pulling an address book of users and groups from the server to the client. The tables and objects are identical.
I'm having difficulties keeping relationships in tact, getting hibernate to insert parent/child objects instead of trying to update objects, etc.
In general, is this a good practice or should I use DTOs across the web service with marshalling at both ends? I'm not sure if my senario is an appropriate use of Hibernate or not.
Thanks.
|