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")