Caused by: <openjpa-2.2.3-SNAPSHOT-r422266:1677238 fatal user error> org.apache.openjpa.persistence.ArgumentException: In "main.java.jpa.OepRole.oepUsers" it is declared that it is mapped to "OepRole", but it is not a field of the associated type.
at org.apache.openjpa.meta.FieldMetaData.getMappedByMetaData(FieldMetaData.java:867)
at org.apache.openjpa.jdbc.meta.FieldMapping.getMappedByMapping(FieldMapping.java:447)
at org.apache.openjpa.jdbc.meta.MappingRepository.useInverseKeyMapping(MappingRepository.java:1047)
.....
at org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:997)
at com.ibm.ws.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:160)
at com.ibm.ws.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:139)
at com.ibm.ws.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:50)
at ru.soa.service.sudir.itdi.smallsystem_generic_webservice_connector._1_0.GenericAccountManagementSoapBindingImpl.getAccountList(GenericAccountManagementSoapBindingImpl.java:684)
我想表格链接中的问题。我想表格链接中的问题。这是我试图链接我的表格的方式。
It OepRole table
//bi-directional many-to-one association to OepUser
@OneToMany(mappedBy="OepRole")
private List<OepUser> oepUsers;
It OepUser table
//bi-directional many-to-one association to OepRole
@ManyToOne()
@JoinColumn(name="USER_ROLE_ID")
private OepRole oepRole;
我试图改变mappedBy
,尝试了所有不合逻辑的逻辑动作,但它并没有帮助我。我做错了什么?
答案 0 :(得分:1)
试试这个,OepRole
名称 @OneToMany(mappedBy="oepRole")
private List<OepUser> oepUsers;
@ManyToOne()
@JoinColumn(name="USER_ROLE_ID",nullable=false)
private OepRole oepRole;
和另一个实体变量中的变量名必须匹配。
{{1}}