-->
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.  [ 1 post ] 
Author Message
 Post subject: Confused about cascade="save-update" vs. inverse=&
PostPosted: Mon Mar 21, 2005 1:33 pm 
Newbie

Joined: Tue Feb 22, 2005 4:10 pm
Posts: 19
When reading Hibernate in Action,

On page 110, it says:
"Without the inverse attribute, Hibernate would try to execute two different SQL statements, both updating the same foreign key column..."

Does that mean that this will happen when you end up calling both? i.e.:
session.save(item);
session.save(bid);

So, when calling session.save(item), Hibernate would grab the foreign key out of 'bid' and store it in the ITEM table. Then, when calling session.save(bid), Hibernate would persist 'bid' to BID table, grab its primary key (possibly just out of 'bid' instance) and then update ITEM table with it (as a foreign key)?

And same would be true if cascade="save-update" is specified and inverse="false", expect the second call, session.save(bid), would be implicit (Hibernate takes care of this).


Is this understanding correct?

Thanks,
NG.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.