[英]EclipseLink JPA uses a non-entity as target entity in the relationship attribute
[英]EclipseLink ValidationException - non-entity [class long] as target entity in the relationship attribute [field providerId]
嘗試將應用程序部署到Glassfish時收到以下錯誤。 顯然我的人際關系有問題。
嘗試部署時,來自Glassfish服務器的錯誤:
ValidationException Exception Description: [class edu...clinic.Treatment]
uses a non-entity [class long] as target entity in the relationship attribute
[field providerId]
我的“治療”類文件中的多對一關系:
@Entiity
...
@ManyToOne
@JoinColumn(name = "provider_fk", referencedColumnName = "npi")
private long providerId;
我的“提供者”類文件中的一對多關系:
@Entity
...
@Id
@Column(name = "NPI")
private long npi;
...
@OneToMany(mappedBy = "providerId", targetEntity=Treatment.class)
@OrderBy
private List<Treatment> treatments;
我相信我的注釋是正確的,但是有些不對勁。 對於如何解決此問題,我將不勝感激。
請嘗試以下操作,在“處理實體更改”中
private long providerId;
至
private Provider provider;
在提供者實體變更中
@OneToMany(mappedBy = "providerId", targetEntity=Treatment.class)
至
@OneToMany(mappedBy = "provider", targetEntity=Treatment.class)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.