This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Inverse in Bidirectional Mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Inverse in Bidirectional Mapping" Watch "Inverse in Bidirectional Mapping" New topic

Inverse in Bidirectional Mapping

vivek dhiman
Ranch Hand

Joined: Aug 05, 2011
Posts: 111


I was just going through 1-M bidirectional mapping's inverse keyword in hibernate. I searched lot but not able to find example where there should be mandatory to have an inverse true. Just observed the difference in number of update queries fired. Can any one provide some example where it is necessary to make inverse=true.

Bill Gorder

Joined: Mar 07, 2010
Posts: 1646

Well you don't need to use inverse if you are using mappedBy. The only difference is mappeBy explicitly points to the owning side where as inverse=true does not. Inverse does not require knowledge of an owning side in fact their might not even be one. I guess the point I am making is every time you add a mappedBy you are in essence setting inverse-true

[How To Ask Questions][Read before you PM me]
It is sorta covered in the JavaRanch Style Guide.
subject: Inverse in Bidirectional Mapping
Similar Threads
Hibernate- one to many mapping problem
Unidirection Association
Query on many-to-many without inverse option set
Associations in Hibernate
Inverse Question