当我尝试在 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
...
@OneToMany(mappedBy = "profile", orphanRemoval = true)
private Set<ProfileEventMapping> events = new HashSet<>();
配置文件事件映射:
@Entity
public class ProfileEventMapping
...
@NotNull
@ManyToOne
private Profile profile;
在我的 persistence.xml 中,我选择包含所有实体:
<exclude-unlisted-classes>false</exclude-unlisted-classes>
有人有想法吗?