HHH-14573 Remove useless call to EnhancementAsProxyLazinessInterceptor#isInitialized()

This commit is contained in:
Andrea Boriero 2021-04-22 17:14:22 +02:00 committed by Andrea Boriero
parent c29b2d27ee
commit 8dabefd111
2 changed files with 3 additions and 9 deletions

View File

@ -355,9 +355,7 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry {
if ( enhancementAsProxyLazinessInterceptor.hasWrittenFieldNames() ) {
return false;
}
// When a proxy has dirty attributes, we have to treat it like a normal entity to flush changes
return !enhancementAsProxyLazinessInterceptor.isInitialized()
|| !persister.hasCollections() && !( (SelfDirtinessTracker) entity ).$$_hibernate_hasDirtyAttributes();
return true;
}
}
else if ( entity instanceof HibernateProxy ) {

View File

@ -15,7 +15,6 @@ import org.hibernate.bytecode.enhance.spi.interceptor.EnhancementAsProxyLaziness
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.PersistenceContext;
import org.hibernate.engine.spi.PersistentAttributeInterceptable;
import org.hibernate.engine.spi.PersistentAttributeInterceptor;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.internal.CoreLogging;
@ -109,11 +108,8 @@ public class WrapVisitor extends ProxyVisitor {
}
else {
if ( entity instanceof PersistentAttributeInterceptable ) {
final PersistentAttributeInterceptor interceptor = ( (PersistentAttributeInterceptable) entity ).$$_hibernate_getInterceptor();
if ( interceptor instanceof EnhancementAsProxyLazinessInterceptor ) {
if ( !( (EnhancementAsProxyLazinessInterceptor) interceptor ).isInitialized() ) {
return null;
}
if ( ( (PersistentAttributeInterceptable) entity ).$$_hibernate_getInterceptor() instanceof EnhancementAsProxyLazinessInterceptor ) {
return null;
}
}