matsekberg wrote:
emmanuel wrote:
It will delete the orphans if you keep the same collection instance Hibernate give to you.
And if I have to make the update (in my case removal of children) in another collection (lost since I have made entity->DTO->entity)?
Is it possible to get hibernat on the track again?
Im not sure exactly what you are asking, but I think you want to edit a different collection and put the stuff back in the hib collection.
Code:
List newList = process(hibObj.getHibList());
//process newList
//... [insert code here]
//now you need to put the objects back in the hib list
//(dont clear, add and retain):
hibObj.getHibList().addAll(newList);
hibObj.getHibList().retainAll(newList);
Chris