Using inverse true in hibernate

后端 未结 2 1739
忘了有多久
忘了有多久 2021-01-02 05:16

I am going through the hibernate documentation and came across the concept of inverse attribute. I am new to Hibernate so I am feeling difficulty in understanding the concep

2条回答
  •  没有蜡笔的小新
    2021-01-02 05:53

    inverse="true" basically means that the inverse relationship is also mapped within the class definition of the other class. But, it's real meaning is that it defines which side is the parent or the relationship owner for the two entities (parent or child). Hence, inverse="true" in a Hibernate mapping shows that this class (the one with this XML definition) is the relationship owner; while the other class is the child.

    If you want to know more about this, then I would definitely have a look at this article: http://www.mkyong.com/hibernate/inverse-true-example-and-explanation/ because it's easy to be misled of the meaning of this attribute in hibernate.

提交回复
热议问题