Hi,
I'm evaluating ObjectDB for storing Objects modeled with Eclipse Modeling Framework (EMF)
and encountered the following problem:
I took the Point-example from the tutorial and added a list-attribute which is declared as java.util.List but the actual Object MyList just extends ArrayList as shown below.
@Entity public class Point implements Serializable { ... private List list = new MyList(); ... } public class MyList extends ArrayList { // nothing in here }
But storing the object causes this error message:
Exception in thread "main" [ObjectDB 2.4.7_08] javax.persistence.RollbackException
Failed to commit transaction: Attempt to store an instance of a non persistable type tutorial.MyList - field tutorial.MyPoint.list (error 613)
at com.objectdb.jpa.EMImpl.commit(EMImpl.java:290)
at tutorial.TestMyList.main(TestMyList.java:21)
Caused by: javax.persistence.PersistenceException: com.objectdb.o.UserException: Attempt to store an instance of a non persistable type tutorial.MyList - field tutorial.MyPoint.list
at com.objectdb.o._PersistenceException.b(_PersistenceException.java:47)
at com.objectdb.o.JPE.g(JPE.java:142)
at com.objectdb.o.JPE.g(JPE.java:78)
... 4 more
Caused by: com.objectdb.o.UserException: Attempt to store an instance of a non persistable type tutorial.MyList - field tutorial.MyPoint.list
at com.objectdb.o.MSG.d(MSG.java:61)
at com.objectdb.o.TYW.writeElement(TYW.java:250)
at com.objectdb.o.UMR$S.A(UMR.java:995)
at com.objectdb.o.UMR.z(UMR.java:565)
at com.objectdb.o.UML.u(UML.java:537)
at com.objectdb.o.MMM.af(MMM.java:1047)
at com.objectdb.o.UTY.aF(UTY.java:1226)
at com.objectdb.o.UTY.aE(UTY.java:1215)
at com.objectdb.o.ENH.a(ENH.java:46)
at com.objectdb.o.STA.T(STA.java:512)
at com.objectdb.o.STM.E(STM.java:425)
at com.objectdb.o.OBM.bL(OBM.java:903)
at com.objectdb.jdo.PMImpl.bL(PMImpl.java:2192)
at com.objectdb.o.OBM.bK(OBM.java:819)
at com.objectdb.o.OBM.bI(OBM.java:734)
at com.objectdb.jpa.EMImpl.commit(EMImpl.java:287)
... 1 more
I thought this would be possible, or am I doing something wrong?
The background is that EMF has for some Java-elements such as List, Map, etc. it's own analog elements EList, EMap, etc.
An EList inherits from or implements java.util.List but has some additional methods such as for swapping elements position in the list.
So can the above problem be solved with ObjectDB or has anyone experiences with saving EMF-objects with ObjectDB?
With best regards,
Thomas