HHH-15274 Optimise LazyAttributeLoadingInterceptor's routines to identify lazy fields

This commit is contained in:
Sanne Grinovero 2022-05-14 17:05:51 +01:00 committed by Sanne Grinovero
parent 3630fbad9b
commit 8e78a61bcc
1 changed files with 4 additions and 1 deletions

View File

@ -29,6 +29,8 @@ import org.hibernate.persister.entity.EntityPersister;
*/ */
public class LazyAttributeLoadingInterceptor extends AbstractLazyLoadInterceptor { public class LazyAttributeLoadingInterceptor extends AbstractLazyLoadInterceptor {
private final Object identifier; private final Object identifier;
//N.B. this Set needs to be treated as immutable
private final Set<String> lazyFields; private final Set<String> lazyFields;
private Set<String> initializedLazyFields; private Set<String> initializedLazyFields;
@ -39,7 +41,8 @@ public class LazyAttributeLoadingInterceptor extends AbstractLazyLoadInterceptor
SharedSessionContractImplementor session) { SharedSessionContractImplementor session) {
super( entityName, session ); super( entityName, session );
this.identifier = identifier; this.identifier = identifier;
this.lazyFields = lazyFields; //Important optimisation to not actually do a Map lookup for entities which don't have any lazy fields at all:
this.lazyFields = org.hibernate.internal.util.collections.CollectionHelper.toSmallSet( lazyFields );
} }
@Override @Override