| I have a parent p1 associated with a set of children (c11,c12,c13...).
I have another parent p2 associated with another set of children (c21,c22,c23...)
 
 All the above are persisted instances.
 
 What is the best approach to swap parents?
 
 I want to do something like p1 associated to c21,c22,c23 and p2 associated to c11,c12,c13.
 
 I have the following Parent/Child class.
 
 class Parent {
 
 private Set<Child> children;
 
 }
 
 class Child {
 private Parent parent;
 
 }
 
 
 Can anyone help me with a piece of code snippet to do the swapping?
 
 
 |