Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bidirectional - Only one @JoinColumn

 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[P-276]:
"Note that you do not have to define @JoinColumn in the entities of both sides of one-to-one relationships."
Does this mean that we "Do Not Have To" OR "We Can't" define @JoinColumn in the entities of both sides of one-to-one
relationships?

Moreover [P-279p Of EJB3 In Action Book States:
"Note that the exact @JoinColumn specification could have been repeated for both the Bid.item and Item.bids
persistent fields on either side of the relationship."

The contradiction of this statement is @ [P-280]
"The persistence provider will generate deployment-time errors if you specify @JoinColumn on both sides of a
bidirectional one-to-many relationship."

Does this mean repetation of @JoinColumn is allowed in "OneToMany - ManyToOne" case but not allowed in bidirectional
"OneToOne" ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic