2015-04-02 66 views
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> 

任何人的想法?

+0

不確定這是否與問題有關,但我只注意到ProfileEventMapping中的Profile被註釋與OneToOne,這應該是ManyToOne。 – 2015-04-02 08:54:42

+0

謝謝,我錯了。與錯誤無關。 – perotom 2015-04-02 08:57:59

+0

請嘗試從persistence.xml中移除。無論如何,容器將選擇註釋實體 – 2015-04-02 09:05:11

回答

0

我只是找到並替換了這個洞項目。問題在於ear項目是一個依賴於一箇舊的.war文件,其中有一個persistence.xml文件。剛剛刪除了舊的依賴和BOOM。現在我只需要修復其他錯誤消息(「com.Profile [id = null]不是已知的實體類型」)

相關問題