What does relationship owner means in bidirectional relationship?

前端 未结 2 1259
刺人心
刺人心 2020-12-12 20:47

I have a simple model with a Question and Choice object.

  • ONE Question has MANY CHOICE(S).
  • MANY Choice has ONE Question
2条回答
  •  春和景丽
    2020-12-12 21:48

    It is also important to remember that without mappedBy you will run into an issue of circular dependencies. This happens when there is no owner in a bidirectional relationship.

    In a circular dependency you will (explicitly) set both sides of the entities before saving

    thisObj.set(thatObj);
    thatObj.set(thisObj);
    

提交回复
热议问题