Hibernate Inverse attribute

前端 未结 4 1908
孤街浪徒
孤街浪徒 2021-02-04 17:38

I am creating a one-to-many relationship. so, i have a parent and a child. The cascade attribute is set to all.

I was wondering, if we consider the following piece of co

4条回答
  •  臣服心动
    2021-02-04 18:02

    In a parent child relation ship between two different entities,

    e.g one to many(1:N) or many to one(N:1)

    Parent <-> Child. (Owner) (Inverse)

    If parent is owner then child is its inverse.

    Using the inverse is always check for child.

    By default we always consider from parent side. So by default inverse = false means parent is owner.

    If inverse= true then child is owner. So persisting of entity will always take from owner side.

提交回复
热议问题