-->
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: Help with sets
PostPosted: Wed Dec 09, 2009 4:49 pm 
Newbie

Joined: Thu Nov 05, 2009 2:39 pm
Posts: 7
I have an object that has a set attached to it containing several objects associated with it.

When I try to insert my object into the database, it fails because it tries to insert the child set with the parent ID as 0, rather than what the parent object has been inserted as.

My hibernate mapping looks like this:

<set name="Users" cascade="save-update" lazy="true" inverse ="true" >
<key column ="Parent_Id">
</key>
<one-to-many class ="User"></one-to-many>
</set>

And I can clearly see it trying to set the parent_id as '0', shouldn't it insert the parent first, and then use the ID of the inserted value for the set??


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.