Hibernate Inverse attribute

前端 未结 4 1912
孤街浪徒
孤街浪徒 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:10

    Inverse is only to tell NH that the foreign key is mapped twice, usually as a one-to-many and a many-to-one, and that it therefore only needs to be stored from one side.

    Q1) the child is stored by cascade, but the parent-FK is null. (Except you set the parent relation in the child within p.addChild(c).)

    Q2) same as Q1.

    Q3) exactly.

提交回复
热议问题