Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why do we need to specity the owner side of the relationship

 
maizar samman
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Can anybody tell me the idea of ownering in the bidirectional relationships?
Why the Entity Manager needs to know the owner side of the relationship?
your help is appreciated
 
John Bengler
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Maizar,

maybe this could help you: EJB3 Entity Relationship


John
 
maizar samman
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks John,
I read this thread before but actually I didn't find the answer to why knowing the owner side is helpful to the Entity Manager
now, I know how to use @mappedBy in the relationships but dont know why it exists at the first place
 
John Bengler
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I'm not sure if there is a deeper meaning, I see it more as a convenient way of defining a bidirectional relation.

One reason I can imagine is that you somehow have to "link" both sides of a bidirectional relationship, if you use features like CASCADE, but this is just an idea.

 
maizar samman
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yea John I think using it when using cascade makes sense a bit .. only a bit
but I think there must be a deeper meaning for it otherwise they won't make it a mandatory element (isn't it mandatory in the bidirectional relationship?!)
 
John Bengler
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouldn't we have just two unidirectional relations when we don't use the mappedBy?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic