Hi all,
I'm testing ObjectDB for my project, but I have troubles with it. At this time I'm not able to remove customer entity, when it's read by a query (it's attached), it throws this exception:
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException:
com.objectdb.o._RollbackException: Failed to commit transaction: 51
...
Caused by: com.objectdb.o._RollbackException: Failed to commit transaction: 51 at com.objectdb.o.JPE.g(JPE.java:89) at com.objectdb.o.ERR.f(ERR.java:59) at com.objectdb.o.OBC.onObjectDBError(OBC.java:1451) at com.objectdb.jpa.EMImpl.commit(EMImpl.java:277) ... 39 more Caused by: java.lang.ArrayIndexOutOfBoundsException: 51 at com.objectdb.o.BYR.A(BYR.java:892) at com.objectdb.o.BYR.A(BYR.java:207) at com.objectdb.o.VUT.l(VUT.java:703) at com.objectdb.o.UML.o(UML.java:312) at com.objectdb.o.ENT.X(ENT.java:872) at com.objectdb.o.STA.P(STA.java:458) at com.objectdb.o.STM.E(STM.java:433) at com.objectdb.o.OBM.bG(OBM.java:781) at com.objectdb.o.OBM.bE(OBM.java:715) at com.objectdb.jpa.EMImpl.commit(EMImpl.java:274) ... 40 more
After this exception is the entity detached (why?). When I merge it, I can remove it without problems...
The Customer class code:
@Entity public class Customer implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue private Long id; private String name; private String surname; @OneToOne(cascade=CascadeType.ALL, fetch=FetchType.EAGER, optional=false, orphanRemoval=true) private Address address; @OneToMany(mappedBy = "customer", fetch= FetchType.LAZY) private List<Item> itemList; @OneToMany(mappedBy = "customer", fetch= FetchType.LAZY) private List<OtherItem> otherItemList; ... getters and setters }
Only address is filled, itemList and otherItemList are empty.
The query:
em.createQuery("select c from Customer c").getResultList();
Code for removing:
em.getTransaction().begin(); try { //c = em.merge(c); em.remove(c); em.getTransaction().commit(); } catch (Exception e) { em.getTransaction().rollback(); throw new RuntimeException(e); }
My env: Netbeans 7, Java 1.6.24, ObjectDB 2.2.6_02 (same result with 2.2.5)
What does the exception mean? Where is the mistake?
Thank you
Michael