-->
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: unidirectional many-to-one with cascade question
PostPosted: Tue Sep 28, 2004 11:48 am 
Newbie

Joined: Thu Aug 12, 2004 10:27 am
Posts: 17
Hibernate version:2.1.6

Name and version of the database you are using:postgresql 7.2

Hi everybody,

Suppose I have two classes (A and B) and I am using a many-to-one unidirectional association from B to A (B has a foreign-key to A). How will changes in class A objects be cascaded to associated class B objects?

Does cascade="delete" mean that when an Object from class A is deleted, all associated objects from class B will be deleted?

Does cascade="save-update" mean that when an Object from class A is saved or updated, all associated objects from class B will be saved or updated?

Will the changes in object A be cascaded to associated objects from class B even if the class B objects are not loaded in the current session? In other words, will hibernate load the associated class B objects to cascade the changes?

I've searched in your forum and in the Hibernate in Action book but I could not find an answer for this. Please, help me.

Thanks,
Jair Jr


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 14, 2004 10:57 am 
Newbie

Joined: Mon Dec 13, 2004 6:26 am
Posts: 2
The cascade attribute is directional. It affects only the one end of the assiciation - the end where it has been applied. Your association end in B referes to A. With cascade applied - operations will be cascaded to A. Read the chapters 3.7.4 and 3.7.5 carefully. It's all there.


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.