0
我爲能夠使用JPA時,我只映射到一個表使實體類行只讀在JPA
我們得到的值時,我已經映射相關表出現錯誤
Only one may be defined as writable, all others must be specified read-only.
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[userId1]
我米使用[的EclipseLink-0](Eclipse持久服務 - 2.0.1.v20100213-r6600)
在子表我有此代碼
@OneToMany(cascade = CascadeType.ALL, mappedBy = "albumId")
private Collection<Images> imagesCollection;
@JoinColumn(name = "user_id", referencedColumnName = "User_ID")
@ManyToOne(optional = false)
private Roleuser userId;
@JoinColumn(name = "album_image", referencedColumnName = "image_id")
@ManyToOne
private Images albumImage;
@JoinColumn(name = "album_image", referencedColumnName = "image_id")
@ManyToOne
private Images albumImage1;
@JoinColumn(name = "user_id", referencedColumnName = "User_ID")
@ManyToOne(optional = false)
private Roleuser userId1;
之一
在此代碼中我必須做什麼更改才能使字段爲只讀?
還是有沒有更好的解決方法不使這些領域只讀?
去openJPA沒有問題,所以我認爲...可能是後來繞過...以及我有一個更多的問題... http://stackoverflow.com/questions/3567438/select-from-兩個表使用jpql – 2010-08-25 15:19:58
我不太瞭解JPA,但我使用netbeans生成的實體類,它們與openJPA相同... – 2010-08-25 15:21:59
netbeans生成類...以及爲什麼netbeans生成兩個單一關係的引用...我應該爲NetBeans提供一個錯誤... – 2010-08-25 20:12:07