-->
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: Parent-Child, basic question
PostPosted: Thu Feb 26, 2004 4:47 pm 
Newbie

Joined: Mon Feb 23, 2004 2:45 pm
Posts: 6
In the Parent-Child document:

http://www.hibernate.org/155.html

a Child is added to the Parent's set and both Parent and Child are saved explicitly.

In various postings and other examples with Parent-Child relationship it is only the Parent that is being saved explicitly.

I have been playing with a Parent-Child (sort of, I have a composite-id) relationship and Hibernate generates INSERT statement for the Parent and only an UPDATE statement for the Child (I was expecting an INSERT statement for the Child as well).

So, before posting mappings and code, I just want to confirm that (provided that all settins,mappings are correct) a Child, that has been added to a parent's collection will be inserted in the corresponding table upon session.save(Parent), without having to explicitly save the Child as well.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 7:02 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This is exactly explained in the "cascades" section of the parent-child-relationships chapter.


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.