aspose file tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes mappedBy attribute doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Reply Bookmark "mappedBy attribute doubt" Watch "mappedBy attribute doubt" New topic
Author

mappedBy attribute doubt

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 8795

What exactly does the mappedBy acheives?? Isn't it enough that I just use the @JoinColumn Annotation? Why do I need a mappedBy when I have a Bi-Directional association?


SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
Originally posted by Jothi Shankar Kumar Sankararaj:
What exactly does the mappedBy acheives?? Isn't it enough that I just use the @JoinColumn Annotation? Why do I need a mappedBy when I have a Bi-Directional association?


mappedBy specifies the relationship is bi-directional. If you do not specify the mappedBy the relationships are still valid but these are independent one directional two separate relationships each one is owning side of the relationship in these two relationship.

At the Object model level this may not have importance, but at relationship level it decide that the foregion keys are alway store in the table which is related to the Object which does not have mappedBy attribute.

Thanks


Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 8795

Thanks!
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: mappedBy attribute doubt
 
Similar Threads
JPA2.0 CascadeType.ALL doesn't cascade persist
@ManayToMany
what us mean mappedBy="item" ?
MDB on glassfish without mappedBy
Entities association relationship defaults - Choose Correct statement