JPA EclipseLink在关系属性中使用非实体作为目标实体 [英] JPA EclipseLink uses a non-entity as target entity in the relationship attribute

查看:168
本文介绍了JPA EclipseLink在关系属性中使用非实体作为目标实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在glassfish 4.1上部署应用程序时,出现以下错误:

I get the following error when i try to deploy my application on glassfish 4.1:

[class com.sample.model.Profile] uses a non-entity [class com.sample.model.ProfileEventMapping] as target entity in the relationship attribute [field events].

两个实体的表都已在数据库中创建.

The tables for both entities are getting created in the database.

个人资料:

@Entity
public class Profile
...
@OneToMany(mappedBy = "profile", orphanRemoval = true)
private Set<ProfileEventMapping> events = new HashSet<>();

ProfileEventMapping:

ProfileEventMapping:

@Entity
public class ProfileEventMapping
...
@NotNull
@ManyToOne
private Profile profile;

,在我的persistence.xml中,我选择包括所有实体:

and in my persistence.xml i choose to include all entities:

<exclude-unlisted-classes>false</exclude-unlisted-classes>

有人有主意吗?

推荐答案

我仅通过查找和替换就重命名了Hole项目.问题是在ear项目中,它依赖于其中包含persistence.xml的旧.war文件.刚刚删除了旧的依赖项和BOOM.现在,我只需要修复其他错误消息("com.Profile [id = null]不是已知的实体类型")

I renamed the hole project with just find and replace. The problem was that in the ear project was a dependency to an old .war file which had an persistence.xml in it. Just deleted the old dependency and BOOM. Now i just need to fix the other error messages ("com.Profile[id = null] is not a known entity type")

这篇关于JPA EclipseLink在关系属性中使用非实体作为目标实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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