HHH-12718 Avoid double negations in DefaultFlushEntityEventListener#dirtyCheck
This commit is contained in:
parent
e53e0ef790
commit
da2d986efb
|
@ -553,7 +553,8 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
|
|||
event.setDatabaseSnapshot( null );
|
||||
|
||||
final boolean interceptorHandledDirtyCheck;
|
||||
boolean cannotDirtyCheck;
|
||||
//The dirty check is considered possible unless proven otherwise (see below)
|
||||
boolean dirtyCheckPossible = true;
|
||||
|
||||
if ( dirtyProperties == null ) {
|
||||
// Interceptor returned null, so do the dirtycheck ourself, if possible
|
||||
|
@ -562,8 +563,8 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
|
|||
|
||||
interceptorHandledDirtyCheck = false;
|
||||
// object loaded by update()
|
||||
cannotDirtyCheck = loadedState == null;
|
||||
if ( !cannotDirtyCheck ) {
|
||||
dirtyCheckPossible = loadedState != null;
|
||||
if ( dirtyCheckPossible ) {
|
||||
// dirty check against the usual snapshot of the entity
|
||||
dirtyProperties = persister.findDirty( values, loadedState, entity, session );
|
||||
}
|
||||
|
@ -585,14 +586,14 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
|
|||
// - dirtyProperties will only contain properties that refer to transient entities
|
||||
final Object[] currentState = persister.getPropertyValues( event.getEntity() );
|
||||
dirtyProperties = persister.findDirty( entry.getDeletedState(), currentState, entity, session );
|
||||
cannotDirtyCheck = false;
|
||||
dirtyCheckPossible = true;
|
||||
}
|
||||
else {
|
||||
// dirty check against the database snapshot, if possible/necessary
|
||||
final Object[] databaseSnapshot = getDatabaseSnapshot( session, persister, id );
|
||||
if ( databaseSnapshot != null ) {
|
||||
dirtyProperties = persister.findModified( databaseSnapshot, values, entity, session );
|
||||
cannotDirtyCheck = false;
|
||||
dirtyCheckPossible = true;
|
||||
event.setDatabaseSnapshot( databaseSnapshot );
|
||||
}
|
||||
}
|
||||
|
@ -603,7 +604,6 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
|
|||
}
|
||||
else {
|
||||
// the Interceptor handled the dirty checking
|
||||
cannotDirtyCheck = false;
|
||||
interceptorHandledDirtyCheck = true;
|
||||
}
|
||||
|
||||
|
@ -611,7 +611,7 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
|
|||
|
||||
event.setDirtyProperties( dirtyProperties );
|
||||
event.setDirtyCheckHandledByInterceptor( interceptorHandledDirtyCheck );
|
||||
event.setDirtyCheckPossible( !cannotDirtyCheck );
|
||||
event.setDirtyCheckPossible( dirtyCheckPossible );
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue