-->
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: Natural-id and how to save transient children on it
PostPosted: Sun Jan 23, 2011 9:34 pm 
Newbie

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?


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.