-->
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: Cascading save/update question
PostPosted: Thu Feb 26, 2004 9:20 pm 
Beginner
Beginner

Joined: Thu Nov 06, 2003 10:04 pm
Posts: 22
I am trying to determine how cascading works. If I set cascade="all" on a particular Parent/Child one-to-one (modelled as many-one foreign key type ) relationship, then if I pass the Parent to session.save(), then does that pass the child also to session.save()?

If that is the case, is it true even if the child has already been saved in a previous session separately (and hence has a valid id value)? Does session.save(parent) still result in a session.save( child ) ?

So basically the question is does session.save( object ) always result in a CREATE query for that object and also all children in its entire object graph? This question assumes, cascade="all" is set on the parent/child relationship.

Thanks
Rama


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 10:44 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
No matter whether you are saving or updating an entity, all the cascades resulting from that operation will issue *either* an insert or an update depending on a few checks such as a version property, the unsaved-value specified for the id, and finally the result of the Interceptor.isUnsaved() method (if one).


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.