0
我收到以下錯誤,當我嘗試部署我在GlassFish 4.1應用:在越來越創建JPA的EclipseLink使用非實體目標實體的關係屬性
[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<>();
ProfileEventMapping:
@Entity
public class ProfileEventMapping
...
@NotNull
@ManyToOne
private Profile profile;
,並在我的persistence.xml我選擇包括所有實體:
<exclude-unlisted-classes>false</exclude-unlisted-classes>
任何人的想法?
不確定這是否與問題有關,但我只注意到ProfileEventMapping中的Profile被註釋與OneToOne,這應該是ManyToOne。 – 2015-04-02 08:54:42
謝謝,我錯了。與錯誤無關。 – perotom 2015-04-02 08:57:59
請嘗試從persistence.xml中移除。無論如何,容器將選擇註釋實體 –
2015-04-02 09:05:11