Skip to content

Commit 8e78a61

Browse files
committed
HHH-15274 Optimise LazyAttributeLoadingInterceptor's routines to identify lazy fields
1 parent 3630fba commit 8e78a61

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/interceptor/LazyAttributeLoadingInterceptor.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
*/
3030
public class LazyAttributeLoadingInterceptor extends AbstractLazyLoadInterceptor {
3131
private final Object identifier;
32+
33+
//N.B. this Set needs to be treated as immutable
3234
private final Set<String> lazyFields;
3335
private Set<String> initializedLazyFields;
3436

@@ -39,7 +41,8 @@ public LazyAttributeLoadingInterceptor(
3941
SharedSessionContractImplementor session) {
4042
super( entityName, session );
4143
this.identifier = identifier;
42-
this.lazyFields = lazyFields;
44+
//Important optimisation to not actually do a Map lookup for entities which don't have any lazy fields at all:
45+
this.lazyFields = org.hibernate.internal.util.collections.CollectionHelper.toSmallSet( lazyFields );
4346
}
4447

4548
@Override

0 commit comments

Comments
 (0)