The attached test case produces a ClassCastException when run (mvn test) with enhancement enabled. It runs fine without.
{noformat} 2016-07-22 23:01:26,237 DEBUG org.hibernate.SQL - insert into Thing (id) values (null) 2016-07-22 23:01:26,261 DEBUG org.hibernate.SQL - insert into SomeEntity (id, lastChangedAt, parent_id, version) values (null, ?, ?, ?) Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4 sec <<< FAILURE! test(eu.pinske.test.ThingTest) Time elapsed: 3.782 sec <<< ERROR! java.lang.ClassCastException: java.util.HashSet cannot be cast to org.hibernate.collection.spi.PersistentCollection at org.hibernate.event.internal.FlushVisitor.processCollection(FlushVisitor.java:39) at org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:104) at org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:65) at org.hibernate.event.internal.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:59) at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:155) at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:216) at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:85) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:38) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1397) at eu.pinske.test.ThingTest.test(ThingTest.java:30) {noformat}
The exception seems to only occur in these particular circumstances: * the entity uses a PreUpdate-hook * the entity has a Version-column * one collections collection is created before persist, another one after persist
Unfortunately I was not able to narrow it down further. |
|