I am trying to migrate from H2 to H3. I made all changes as instructed in the migration guide. For now, I am using the Hibernate Calssic Session API.
Consider the following the 3 Classes A,B,C and their relationships.
Class A has a bag of Class B
Class A has a bag of Class C
Class B has a bag of Class C
All relationships are biderectional with cascade = all on the one - many side and cascade=none on the many - one side.
Code:
A a = new A();
B b = new B();
C c = new C();
//Now, add b to a's List of b's
b.setA(a);
a.bList.add(b);
//then add c to b's List of c's
c.setB(b);
b.cList.add(c);
//finally set a in c. Minor point: c is not added to a's list of c's
c.setA(a);
//Save a
session.save(a);
session.flush();
I get the following exception:
java.lang.
ArrayIndexOutOfBoundsException: 11
at org.hibernate.event.def.DirtyCollectionSearchVisitor.includeProperty(DirtyCollectionSearchVisitor.java:63)
at org.hibernate.event.def.AbstractVisitor.processValues(AbstractVisitor.java:42)
at org.hibernate.event.def.AbstractVisitor.processComponent(AbstractVisitor.java:62)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:87)
at org.hibernate.event.def.AbstractVisitor.processValues(AbstractVisitor.java:43)
at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:300)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:111)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:190)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:70)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:669)
This used to work fine in H2. Any info would be appreciated. Thank You.