| Author |
@mappedBy
|
mallika shah
Ranch Hand
Joined: May 11, 2006
Posts: 164
|
|
Hello , A question says: A Flight bean and a Reservation bean have a @OneToMany relationship. And asks which code represents the correct relationship. How would a person know which is the owner side and which is the inverse side of the relationship to apply the @mappedBy attribute ? mallika
|
 |
Paul Michael
Ranch Hand
Joined: Jul 02, 2001
Posts: 697
|
|
I'm assuming this relationship is bidirectional because the mappedBy annotation was mentioned. This attribute pertains to the owning side of the relationship. You can read the section on Entity Relationships from the book Enterprise JavaBeans 3.0 (5th Edition) for more details.  [ January 02, 2008: Message edited by: Michael Guevara ]
|
SCJP 1.2 (89%), SCWCD 1.3 (94%), IBM 486 (90%), SCJA Beta (96%), SCEA (91% / 77%), SCEA 5 P1 (77%), SCBCD 5 (85%)
|
 |
waleed zedan
Greenhorn
Joined: Apr 12, 2004
Posts: 10
|
|
Persistence specification: The inverse side of a bidirectional relationship must refer to its owning side by use of the mappedBy element of the OneToOne, OneToMany, or ManyToMany annotation. The mappedBy element designates the property or field in the entity that is the owner of the relationship. So , @mappedby should be placed on the inverse side not the owning side Thanks,
|
Waleed Zedan<br />SCJP 1.4
|
 |
Pawel Dolega
Greenhorn
Joined: May 23, 2006
Posts: 5
|
|
|
Owner side of the relationship is the one which contains foreign key in db table
|
 |
 |
|
|
subject: @mappedBy
|
|
|