-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: merging a persistent object with new objects in graph
PostPosted: Thu Nov 09, 2006 4:51 pm 
Newbie

Joined: Thu Mar 04, 2004 9:10 pm
Posts: 6
We have some code which adds new objects somewhere down in the object graph. We used to rely on cascade to save the object graph, saving any new objects that were added.

Recently, we added caching, so we had to change our hibernate interaction to merge things, because we were dealing with detached objects.

merge cascade does not work with a mixture of detached/persistent and transient/unsaved objects. We looked into the code of the merge cascade in hibernate 3.0 (and 3.2) and saw that it is making a copy of objects, with their ID.

What happens for us is that it does this even though ID of the new child object is null, hibernate makes a copy and sets the ID (which is null). I assume that hibernate later uses this ID to properly get the object information.

But the end result for us is that hibernate hits the "copyCache" for our new object and gets a copy which has all properties set to null.

Could hibernate be patched to make a copy of the object instead of a new instance with only the ID? What is the semantics of merge? Is cascade-merging an object with newly added children considered a "no-no"?

thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.