I get this error every now and again.. and I have no clue what it means.
Code:
ERROR AssertionFailure:45 - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: collection [myproject.domain.Category.children] was not processed by flush()
at org.hibernate.engine.CollectionEntry.postFlush(CollectionEntry.java:228)
at org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:356)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
at jawbs.DatabaseTests.flush(DatabaseTests.java:113)
This occurs when saving a parent object (not a category) that contains a list of categories... and each category contains a list of children categories.
What seems to fix the problem is executing the following code before I execute the saveOrUpdate/flush:
parentObject.getCategories();
I don't really understand why I get this error message. I get it in other cases as well. It doesn't happen too often, but I need to flush after a saveOrUpdate() when I test. There is no way around it. Why is this happening?