HHH-6735 Guard other FieldInterceptorHelper methods called from core

This commit is contained in:
Emmanuel Bernard 2011-10-17 16:36:08 +02:00
parent 6cd8a238a5
commit 02003c1aec
2 changed files with 11 additions and 3 deletions

View File

@ -218,8 +218,9 @@ public final class EntityEntry implements Serializable {
this.version = nextVersion;
getPersister().setPropertyValue( entity, getPersister().getVersionProperty(), nextVersion );
}
FieldInterceptionHelper.clearDirty( entity );
if ( getPersister().getFactory().getServiceRegistry().getService( InstrumentationService.class ).isInstrumented( entity ) ) {
FieldInterceptionHelper.clearDirty( entity );
}
}
/**

View File

@ -46,6 +46,7 @@ import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.pretty.MessageHelper;
import org.hibernate.service.instrumentation.spi.InstrumentationService;
import org.hibernate.type.Type;
/**
@ -220,7 +221,13 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
return true;
}
else {
FieldInterceptionHelper.clearDirty( event.getEntity() );
InstrumentationService instrumentationService = event.getSession()
.getFactory()
.getServiceRegistry()
.getService( InstrumentationService.class );
if ( instrumentationService.isInstrumented( event.getEntity() ) ) {
FieldInterceptionHelper.clearDirty( event.getEntity() );
}
return false;
}
}