0
我不能運行我的項目,因爲我得到這個錯誤:「在關係屬性」中使用非實體[類java.lang.Double]作爲目標實體,我該怎麼做?
Exception Description: Predeployment of PersistenceUnit [RekeningAdministratiePU] failed.
Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException
Exception Description: [class domain.Regio] uses a non-entity [class java.lang.Double] as target entity in the relationship attribute [field wegCategoriePrijzen].
javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [RekeningAdministratiePU] failed.
Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException
Exception Description: [class domain.Regio] uses a non-entity [class java.lang.Double] as target entity in the relationship attribute [field wegCategoriePrijzen].
我的實體類看起來像這樣
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id;
private String naam;
@OneToMany(cascade= { CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE})
private Collection<Locatie> locaties;
@OneToMany(cascade= { CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE})
private Collection<Double> autoCategorieMutaties;
@OneToMany(cascade= { CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE})
private Collection<Double> wegCategoriePrijzen;
private Double binnenrijTarief;
我在做什麼錯在這裏?
非常感謝!這也適用於ArrayList嗎? – 2013-04-09 20:31:12
理論上是,但請記住某些提供程序(如Hibernate)無法在同一個實體對象內映射多個列表。所以它更安全地使用集合或集合。 – Perception 2013-04-09 20:33:45