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.