Hi,
Can someone tell me why DefaultFlushEntityEventListener checks to see if an object is updated before it deletes it? The comment of "ignoring collections unless versioned" seeeeems to indicate that hibernate might be checking to see if someone else has updated the object in the meantime (in which was we'd want the delete to fail).
The code Im looking at is:
Code:
private boolean isUpdateNecessary(final FlushEntityEvent event, final boolean mightBeDirty) {
final Status status = event.getEntityEntry().getStatus();
if ( mightBeDirty || status==Status.DELETED ) {
// compare to cached state (ignoring collections unless versioned)
dirtyCheck(event);
if ( isUpdateNecessary(event) ) {
return true;
}
else {
FieldInterceptor.clearDirty( event.getEntity() );
return false;
}
}
else {
return hasDirtyCollections( event, event.getEntityEntry().getPersister(), status );
}
}
I'm no expert in hibernate, but it seems to me if an object is deleted - you don't want to update it... am I wrong?
Hibernate version:
3.1 rc2