@OneToMany without inverse relationship and without a join table?

前端 未结 3 1823
天命终不由人
天命终不由人 2020-12-08 04:00

This is a similar problem to \"Hibernate @OneToMany without a separate join table\", in that I need a @OneToMany relationship without a join table. However, I would also li

3条回答
  •  时光说笑
    2020-12-08 04:49

    If there is no join table in database, then the relationship between two tables in database would be achieved by foreign key referring to primary key. If the relationship is through PK/FK, there has to be a property in the target class that refers back to the source so that the FK column is populated with a value. This property in the target class could be an id or a source object. If it is a source object then you need to have an inverse @ManyToOne in target class.

提交回复
热议问题