问题
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