A ConcurrentModificationException is being thrown while Hibernate is flushing changes to the database. Specifically, it occurs while it is persisting new "collections" (i.e. one-to-many) entities.
Stacktrace:
java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
at java.util.AbstractList$Itr.next(AbstractList.java:343)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:353)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:279)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1214)
at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:986)
I do have a Post-Insert, Update, Collection Recreate, Collection Update listener where ConcurrentModificationException is only occurring if this listener is in place. However, the listener and actions it takes doesn't modify any entities or make save changes. So I am bit miffed.
This is occurring in what appears to be a single threaded environment. At the very least the entity manager is thread local which means the hibernate events list shouldn't be modified concurrently.
It leads me to believe that the list is being modified within the for loop somehow...
|