HHH-14571 Always report identifiers as initialized when using enhanced proxies

This commit is contained in:
Yoann Rodière 2021-04-22 15:56:45 +02:00
parent 6bc8421972
commit 1023ee02b9
1 changed files with 3 additions and 6 deletions

View File

@ -8,8 +8,8 @@ package org.hibernate;
import java.util.Iterator; import java.util.Iterator;
import org.hibernate.bytecode.enhance.spi.interceptor.BytecodeLazyAttributeInterceptor;
import org.hibernate.bytecode.enhance.spi.interceptor.EnhancementAsProxyLazinessInterceptor; import org.hibernate.bytecode.enhance.spi.interceptor.EnhancementAsProxyLazinessInterceptor;
import org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor;
import org.hibernate.collection.spi.PersistentCollection; import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.HibernateIterator; import org.hibernate.engine.HibernateIterator;
import org.hibernate.engine.jdbc.LobCreator; import org.hibernate.engine.jdbc.LobCreator;
@ -202,11 +202,8 @@ public final class Hibernate {
if ( entity instanceof PersistentAttributeInterceptable ) { if ( entity instanceof PersistentAttributeInterceptable ) {
PersistentAttributeInterceptor interceptor = ( (PersistentAttributeInterceptable) entity ).$$_hibernate_getInterceptor(); PersistentAttributeInterceptor interceptor = ( (PersistentAttributeInterceptable) entity ).$$_hibernate_getInterceptor();
if ( interceptor instanceof EnhancementAsProxyLazinessInterceptor ) { if ( interceptor instanceof BytecodeLazyAttributeInterceptor ) {
return false; return ( (BytecodeLazyAttributeInterceptor) interceptor ).isAttributeLoaded( propertyName );
}
if ( interceptor instanceof LazyAttributeLoadingInterceptor ) {
return ( (LazyAttributeLoadingInterceptor) interceptor ).isAttributeLoaded( propertyName );
} }
} }