2010-07-05 56 views
3

我試圖堅持一個嵌入/可序列化對象的集合作爲我的實體中的字段之一。我已經看到了將列表包裝在另一個可序列化的類中並將整個事物存儲爲高球的訣竅,但這感覺像是一種黑客。據我所知,jpa的方式是在我的列表頂部添加一個@ElementCollection(targetClass=BlaBlaBla.class)註釋。我註釋了我的BlaBlaBla類是可嵌入的。JPA嵌入式集合

不幸的是,AppEngine上給了我這樣的例外:

javax.persistence.PersistenceException: Class "data.Contact" has collection field "properties" and this has no mapping in the table for the element class "data.EntityReference" 
org.datanucleus.jpa.NucleusJPAHelper.getJPAExceptionForNucleusException(NucleusJPAHelper.java: 264) 
org.datanucleus.jpa.EntityTransactionImpl.commit(EntityTransactionImpl.java: 122) 
org.datanucleus.store.appengine.jpa.DatastoreEntityTransactionImpl.commit(DatastoreEntityTransactionImpl.java: 55) 

是可序列化類黑客真的有必要嗎?任何幫助都會很熱。

回答