Hi,
I have question about Hibernate object id policy.
I have client-sevrer architecture with RMI as a communication layer.
I have persistent object A that has a List of persistent objects B. List has cascade option set to all-delete-orphan.
I create A on the client side (the ArrayList List implementation is used) and fill it with instances of objects B.
I pass (via RMI) object A to server to persist it, ids are assigned by Hibernate to all persistent objects.
Now I fill the objects on the client side with ids generated on the server side - if I don't do it, next attempt of saving the objects will create new instances in DB.
I also discovered that I have to use Hibernate implementation of List on the client side (I pass the List via RMI, remove it's contents and add the client-side objects to it). If I don't do it the cascade deleting is not working properly.
I noticed however that sometimes the ids of objects B are reaasigned. It looks that removing objects B from list and assigning them again sometimes causes reassigning persistent id for them. Is it possible? What is the policy of assignig id for persistent objects? Does removing object from a list and assigning it again cause creation of new id for that object?
Thanks for any Help.
John.
_________________ John
|