Joined: Sat Jan 22, 2011 6:49 pm Posts: 1
|
I have a parent-object with some children-objects in an array. I have defined an natural-id on some of the properties of the child, so the children will be unique. Both parent and child have an id-property. When I save the parent some of the children will be transient but in the database already if you look to the natural-id. So if I just try to save the parent i will run into unique-constraint-exceptions. Is there a shorter way of solving this than manually going through each child and searching the database to see if its there already and manually setting the id-property and then merging the child before saving the parent. I have a lot of different kinds of children in the parent. Hibernate provides some magic command here to solve this problem?
|
|