-->
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: A little bit EntityManager merge semantics!
PostPosted: Tue Jan 29, 2008 6:54 am 
Regular
Regular

Joined: Thu May 04, 2006 5:24 am
Posts: 55
Hi,

could we try here to clear a little bit EntityManager merge operation.

If we have one the most simple OneToMany relation between two classes, like this:

|Class1| <>-[1]--------[*]-> |Class2|

So, Class1 containts a list of Class2 elements, and every Class2 element holds reference to its parent Class1 element.

Now, when one merge Class1 object like this:

Code:
Class1 c = new Class1();
c.setSomething(...);

c = hib.merge(c);


What is going on with c instance and its Class2 list? I supose that c is copied as object, but what is with its list of Class2 elements, is it copied by reference or by value, it seems by refrence only ?

I ask this because when I merge some object in this way and then when I try to iterate its Class2 collection it sometimes generate an exception:

Code:
java.util.ConcurrentModificationException


Thx in advance.


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.