-->
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: bidirectional associations problems
PostPosted: Thu Jun 12, 2008 2:06 pm 
Newbie

Joined: Thu Jun 12, 2008 1:51 pm
Posts: 1
Hi there!
I'm new to Hibernate. I'm studing it on Hibernate Quickly by Manning.
I am some problems with bidirectional associations, maybe i didn't understand something... :)
I read that in order to declare a bidirectional associations i must declare inverse="true" in the mapping file of the many end (if one to many) or inverse="true" in a random side (if many to many). With this scenario I have observed that every savings made on the inverse end will not be persisted, and this is an expected behaviour. But if I delete inverse="true" and I declare cascade="all" on both sides of association I can:
- save on both sides
- navigate in each direction
So the question is: WHY I HAVE TO USE inverse="true" if it limits my persist operation?

Thanks 4 help!!!

Carlo


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 14, 2008 9:16 am 
Regular
Regular

Joined: Sun Apr 13, 2008 3:04 am
Posts: 71
Location: Bangalore
Hi,

Could pl. let me know your observations to the following

Class A constains collection of B's.

In this context if you save B, is A is also getting stored..

What if B has one to one assoication with C, then Saving C would B and A also gets saved..

I am seeing few funny issues such as while saving B, it fails on certain cases with exception, however A is getting stored etc.. even after transaction rollback etc.

Regards,
Nagendra

_________________
Raja Nagendra Kumar,
C.T.O
http://www.tejasoft.com
TejaSoft - Specialists in Code Audit, Unit Testing and Merciless Re-factoring - Engineering Crisis Turnaround Experts


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.