-->
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.  [ 4 posts ] 
Author Message
 Post subject: associated updates
PostPosted: Mon Aug 29, 2005 5:12 pm 
I have a parent entity which has multiple one-to-one and one-to-many relationships with other entities. But when I call store on the session for the parent, the child entities don't get persisted at all. In this particular case, the entire obect graph is a set of entities that are created brand new, and the goal is to save the parent and all their associated children. :?


Top
  
 
 Post subject:
PostPosted: Mon Aug 29, 2005 9:26 pm 
Beginner
Beginner

Joined: Mon Aug 15, 2005 11:09 pm
Posts: 23
Do you have inverse set to true on the parent collection? If you do you'll need to persist the other objects yourself.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 10:27 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Have you enable cascading in your mapping ?
(eg. cascade="all-delete-orphan")

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 3:45 pm 
Thanks for your responses. I finally figured out what the problem was. The culprit was due to a one-to-one mapping on a primary key association. I am not able to get this one to one association to work, even after following the text book definition of defining the primary key on the child.

Code:
<id name="CaseID" column="CaseID">
   <generator class="foreign">
   <param name="property">Case</param>
   </generator>            
</id>


Both sides of the relationship have been defined using one-to-one association with the constrained="true" set on the child side of the association.


Top
  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.