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

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

问题描述

在我的应用程序中,我将Hibernate的JPA 2.0用作持久性提供程序。我有两个实体之间的一对多关系(使用 @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天全站免登陆