Minor code refactoring

This commit is contained in:
Sanne Grinovero 2022-12-12 22:59:58 +00:00
parent 371d2f1d49
commit c105c34976
1 changed files with 6 additions and 4 deletions

View File

@ -264,17 +264,19 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry {
this.loadedState = updatedState; this.loadedState = updatedState;
setLockMode( LockMode.WRITE ); setLockMode( LockMode.WRITE );
if ( getPersister().isVersioned() ) { final EntityPersister persister = getPersister();
if ( persister.isVersioned() ) {
this.version = nextVersion; this.version = nextVersion;
getPersister().setValue( entity, getPersister().getVersionProperty(), nextVersion ); persister.setValue( entity, persister.getVersionProperty(), nextVersion );
} }
ManagedTypeHelper.processIfSelfDirtinessTracker( entity, AbstractEntityEntry::clearDirtyAttributes ); ManagedTypeHelper.processIfSelfDirtinessTracker( entity, AbstractEntityEntry::clearDirtyAttributes );
getPersistenceContext().getSession() final SharedSessionContractImplementor session = getPersistenceContext().getSession();
session
.getFactory() .getFactory()
.getCustomEntityDirtinessStrategy() .getCustomEntityDirtinessStrategy()
.resetDirty( entity, getPersister(), (Session) getPersistenceContext().getSession() ); .resetDirty( entity, persister, (Session) session );
} }
private static void clearDirtyAttributes(final SelfDirtinessTracker entity) { private static void clearDirtyAttributes(final SelfDirtinessTracker entity) {