JPA EclipseLink使用非实体作为关系属性中的目标实体
当我尝试在glassfish 4.1上部署应用程序时,出现以下错误:JPA EclipseLink使用非实体作为关系属性中的目标实体,jpa,eclipselink,java-ee-7,glassfish-4.1,Jpa,Eclipselink,Java Ee 7,Glassfish 4.1,当我尝试在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]. 将在数据库中创建这两个实体的表 简介: @Entity public class Profile ... @O
[class com.sample.model.Profile] uses a non-entity [class com.sample.model.ProfileEventMapping] as target entity in the relationship attribute [field events].
将在数据库中创建这两个实体的表
简介:
@Entity
public class Profile
...
@OneToMany(mappedBy = "profile", orphanRemoval = true)
private Set<ProfileEventMapping> events = new HashSet<>();
在我的persistence.xml中,我选择包含所有实体:
<exclude-unlisted-classes>false</exclude-unlisted-classes>
有人有什么想法吗?我用just find and replace重命名了这个洞项目。问题是ear项目中存在对旧.war文件的依赖,该文件中包含persistence.xml。刚刚删除了旧的依赖项和BOOM。现在我只需要修复其他错误消息com.Profile[id=null]不是已知的实体类型不确定这是否与问题相关,但我刚刚注意到ProfileEventMapping中的Profile用OneToOne注释,这应该是ManyToOne。谢谢,我复制错了。与错误无关。请尝试从persistence.xml中删除。容器无论如何都会拾取带注释的实体,但不会更改任何内容。还是会出错。persistence.xml是从netbeansHow生成的。您是否打包了实体?检查这两个类文件相对于所使用的persistence.xml文件是否位于同一位置,特别是在jar中。
<exclude-unlisted-classes>false</exclude-unlisted-classes>