Hi,
We're using Hibernate 3 (final) with an Interceptor that adds createdBy and created (when creating) and changedBy and changed (when updating).
In one case we are getting:
Code:
<2005-apr-14 kl 13:39 CEST> <Error> <Pan> <000000> <AssertionFailure.<init> : 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: dirty, but no dirty properties
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:157)
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:675)
....
I dont know why this is happening, and I'm a newbie to Hibernate... but I pinpointed the error to the
org.hibernate.event.def.DefaultFlushEntityEventListener class and the dirtyCheck method.
It seems that the flag that indicates that a dirty collection exists is never set? So I added the following code:
Code:
....
event.setDirtyProperties(dirtyProperties);
// Added:
if(dirtyProperties != null && dirtyProperties.length > 0) {
event.setHasDirtyCollection(true);
}
// /Added
event.setDirtyCheckHandledByInterceptor(interceptorHandledDirtyCheck);
event.setDirtyCheckPossible(!cannotDirtyCheck);
...
And that fix works for me... But I'm unsure if it's really needed?
Regards,
Lennart