JPA 注释中的 inverse=true [英] inverse=true in JPA annotations

查看:32
本文介绍了JPA 注释中的 inverse=true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我使用 JPA 2.0 和 Hibernate 作为持久性提供程序.我有两个实体之间的一对多关系(使用 @JoinColumn 而不是 @JoinTable).我想知道如何在 JPA 注释中指定 inverse=true(在 hbm.xml 中指定)来反转关系所有者.

In my application I use JPA 2.0 with Hibernate as the persistence provider. I have a one-to-many relationship between two entities (using a @JoinColumn and not @JoinTable). I wanted to know how could I specify inverse=true (as specified in hbm.xml) in JPA annotations to reverse the relationship owner.

谢谢.

推荐答案

我找到了答案.@OneToMany注解的mappedBy属性与xml文件中的inverse = true相同.

I found an answer to this. The mappedBy attribute of @OneToMany annotation behaves the same as inverse = true in the xml file.

这篇关于JPA 注释中的 inverse=true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆