JPA Embedded Collection

I am trying to save a collection of inline / serializable objects as one of the fields in my entity. I saw a trick in which you transfer the list to another serializable class and save it all as a forehead, but it seems like a hack. As far as I can tell, the jpa way to do this is to annotate @ElementCollection(targetClass=BlaBlaBla.class)on top of my list. I annotated the BlaBlaBla class for embedding.

Unfortunately, Appengine gives me this exception:

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) 

Is a serializable class really necessary? Any help would be hot.

+3
source share
1 answer
+2

Source: https://habr.com/ru/post/1753184/


All Articles