It's not a secret anymore!
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Owning side of the relationship Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Owning side of the relationship" Watch "Owning side of the relationship" New topic

Owning side of the relationship

Karnati Sudhakar
Ranch Hand

Joined: Aug 26, 2008
Posts: 270

Hi All,

The owner of the relationship is purely our taste or is there any rule for that?

In EJB 3 in Action for it is given as
For bidirectional one-to-many relationships,ManyToOne is always the owning side of the relationship.

Is it an advice or rule to be followed?

May be i am asking this question because i did not understand the entity relationships fully

Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

This is a rule : The many side of one-to-many / many-to-one bidirectional relationships must be the owning side, hence the mappedBy element cannot be specified on the ManyToOne annotation.

[My Blog]
All roads lead to JavaRanch
Fu Dong Jia
Ranch Hand

Joined: May 23, 2007
Posts: 131
Thanks Christophe!

who dare win!<br />SCJP5(94%)|SCWCD5(86%)|SCBCD(100%)|SCEA in progress
I agree. Here's the link:
subject: Owning side of the relationship
It's not a secret anymore!