在我的应用程序中,我使用 JPA 2.0 和 Hibernate 作为持久性提供程序。我在两个实体之间有一对多关系(使用 @JoinColumn
而不是 @JoinTable
)。我想知道如何在 JPA 注释中指定 inverse=true
(如 hbm.xml
中指定)来反转关系所有者。
谢谢。
最佳答案
我找到了这个问题的答案。 @OneToMany 注释的mappedBy 属性的行为与xml 文件中的inverse = true 相同。
关于hibernate - JPA 注释中的 inverse=true,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4865285/