Removing an entity throws exception


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(
at com.objectdb.o.ERR.f(
at com.objectdb.o.OBC.onObjectDBError(
at com.objectdb.jpa.EMImpl.commit(
... 39 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 51
at com.objectdb.o.BYR.A(
at com.objectdb.o.BYR.A(
at com.objectdb.o.VUT.l(
at com.objectdb.o.UML.o(
at com.objectdb.o.ENT.X(
at com.objectdb.o.STA.P(
at com.objectdb.o.STM.E(
at com.objectdb.o.OBM.bG(
at com.objectdb.o.OBM.bE(
at com.objectdb.jpa.EMImpl.commit(
... 40 more


After this exception is the entity detached (why?). When I merge it, I can remove it without problems...

The Customer class code:

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:

    try {
       //c = em.merge(c);
    catch (Exception e) {
       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



It seems as an internal ObjectDB bug.

Please try build 2.2.6_03 that may fix this exception.

If you still get the exception - it would help if you could upload a test case that demonstrates it.

ObjectDB Support

Thank you for fast response.

The fix changed the number 51 to 34. But it looks like my db was corrupted, because when I tried to create new project as a test case for this bug, with new empty db it works correctly. The objectdb doctor analysis has not found an error. Clearing the old database from all data helps, now it works.



It seems that the bug that your test demonstrates cannot cause a corrupted database.

The problem was the result of comparing object images (used mainly to detected changes when enhancement is not in use) - after schema evolution.

Therefore, starting with a new database file could solve the problem even with no fix, since the schema changes are gone.

So either the bug is not completely fixed, or you still saw it with version 2.2.6_02 because of other reasons (e.g. cache of older ObjectDB jar file by the IDE, etc.)

ObjectDB Support

The fix was indeed incomplete. Build 2.2.6_05 covers an additional case.

If you still have the old database please check it with this new fix.


ObjectDB Support

Build 2.2.6_05 fixed it completly. I tested the old database and no exception was thrown.


Thank you