JPA EclipseLink uses a non-entity as target entity in the relationship attribute

♀尐吖头ヾ 提交于 2020-02-05 13:54:26

问题


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.

Profile:

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

ProfileEventMapping:

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

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

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

anybody an idea?


回答1:


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



来源:https://stackoverflow.com/questions/29408259/jpa-eclipselink-uses-a-non-entity-as-target-entity-in-the-relationship-attribute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!