I've got two objects:
@Entity public class EEvent { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @ManyToOne(optional=false) private ETown town; public ETown getTown() { return town; } public void setTown(ETown town) { this.town = town; } }
And:
@Entity public class ETown { @Id private String id; @OneToMany(mappedBy="town") private Set<EEvent> events; public Set<IEvent> getEvents() { Set<IEvent> events = new HashSet<IEvent>(); if(this.events != null) { events.addAll(this.events); } return events; } public void setEvents(Set<EEvent> events) { this.events = events; } }
Storing the objects works fine and the relationships (both forward and inverse) behave as expected in the Object DB Explorer, however when I try to read the Event type, I'm getting the following exception. As far as I can tell, I'm very closely mirroring the examples on this site. Any pointers?
[ObjectDB 2.2.0] javax.persistence.PersistenceException Failed to read the value of field com.pvdc.model.entity.EEvent.town using reflection (error 363) at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:580) at com.pvdc.odb.ODBHelper.readAllByTypeInternal(ODBHelper.java:249) at com.pvdc.odb.ODBHelper.access$1(ODBHelper.java:242) at com.pvdc.odb.ODBHelper$3.execute(ODBHelper.java:126) at com.pvdc.odb.ODBHelper.executeWrite(ODBHelper.java:158) at com.pvdc.odb.ODBHelper.dropAllByType(ODBHelper.java:123) at com.pvdc.odb.ODBHelper.dropAll(ODBHelper.java:117) at com.pvdc.tests.model.entity.EventEntityTest.setUp(EventEntityTest.java:23) at junit.framework.TestCase.runBare(TestCase.java:132) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:243) at junit.framework.TestSuite.run(TestSuite.java:238) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: com.objectdb.o.UserException: Failed to read the value of field com.pvdc.model.entity.EEvent.town using reflection at com.objectdb.o.MSG.d(MSG.java:74) at com.objectdb.o.UMR.M(UMR.java:834) at com.objectdb.o.UMR.z(UMR.java:563) at com.objectdb.o.UML.v(UML.java:529) at com.objectdb.o.MMM.af(MMM.java:1021) at com.objectdb.o.UTY.aH(UTY.java:1239) at com.objectdb.o.UTY.aG(UTY.java:1211) at com.objectdb.o.ENH.b(ENH.java:99) at com.objectdb.o.LDR.G(LDR.java:406) at com.objectdb.o.LDR.B(LDR.java:153) at com.objectdb.o.OBC.aK(OBC.java:992) at com.objectdb.o.OBC.aI(OBC.java:890) at com.objectdb.o.OBC.UF(OBC.java:789) at com.objectdb.o.SRB.k(SRB.java:149) at com.objectdb.o.QRR.m(QRR.java:487) at com.objectdb.o.QRR.b(QRR.java:188) at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:575) ... 21 more Caused by: com.objectdb.o.UserException: Entity is not found: com.pvdc.model.entity.ETown#'002xtown-EventEntityTest' at com.objectdb.o.MSG.d(MSG.java:61) at com.objectdb.o.ENT.ab(ENT.java:1310) at com.objectdb.o.OBC.aI(OBC.java:892) at com.objectdb.o.OBC.UF(OBC.java:804) at com.objectdb.o.TYR.aG(TYR.java:662) at com.objectdb.o.TYR.completeRead(TYR.java:529) at com.objectdb.o.TYR.readElement(TYR.java:263) at com.objectdb.o.UTY.readAndAdjust(UTY.java:1318) at com.objectdb.o.UMR$P.A(UMR.java:915) at com.objectdb.o.UMR.z(UMR.java:557) ... 35 more