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.  [ 2 posts ] 
Author Message
 Post subject: Saving child entities in xml
PostPosted: Tue Feb 03, 2009 12:26 pm 
Newbie

Joined: Tue Feb 03, 2009 12:21 pm
Posts: 2
Hey,

I'm trying to save some mapped dom4j entities and can't get the children to set the parent id without having to explicity put the id in children.


Code:
<parent name="myparent">
  <child name="child1"/>
  <child name="child2"/>
</parent>



after saving this bit of xml the parent and children are present, but the kids parent id's are null. How do I get it to set this? There are no java classes, so I can't explicity call setParent on the children.

Also,

Is the forum search ever going to get fixed? After searching you can't get to page 2.

Thanks,
Jon


Top
 Profile  
 
 Post subject: Fixed it
PostPosted: Tue Feb 03, 2009 5:06 pm 
Newbie

Joined: Tue Feb 03, 2009 12:21 pm
Posts: 2
Ok, nevermind the problem wasn't that difficult.

just had to set inverse="false" on the parent and set cascade="save-update"

inverse=true requires you to add the parent object to the child, which you probably don't want with xml.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.