-->
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.  [ 5 posts ] 
Author Message
 Post subject: Parent Child Adding Child Updating Parent's Child Coll.
PostPosted: Wed Jun 06, 2007 6:45 am 
Newbie

Joined: Wed Jun 06, 2007 6:37 am
Posts: 3
Hi All;
I am user of NHibernate 1.2., My question is:
There are two 2 class, one is Parent and one is Child, The problem is when I add a new Child to database Parent Collection is not updated automatically, I mean Child object is not added to Parent's Child Collection automatically. Is there a way to do this action?

Also inverse=true has been given in Parent mapping.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 06, 2007 8:35 am 
Newbie

Joined: Wed Jun 06, 2007 6:37 am
Posts: 3
anybody there? help is urgent


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 06, 2007 12:40 pm 
Newbie

Joined: Tue Jun 05, 2007 12:57 am
Posts: 3
I don't think the session can be 'attached' to the DB to be automatically aware of changes made to the DB directly. You'll have to reload the parent to see the child.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 06, 2007 2:45 pm 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
You need to manage the relationship yourself. It's recommended that you have methods AddChild and RemoveChild on the Parent class. Inside these methods you can set the Parent property of the Child.

Cheers,

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 07, 2007 5:00 am 
Newbie

Joined: Wed Jun 06, 2007 6:37 am
Posts: 3
Many Thanks, I just hoped it to be automatically in a way but, now I will add manually... Thanks again


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