Skip to content

Commit 2a40df6

Browse files
committed
HHH-19537 Simplify amount of computations performed during LazyAttributeLoadingInterceptor ctor
1 parent 6bbdf83 commit 2a40df6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ public LazyAttributeLoadingInterceptor(
4242
SharedSessionContractImplementor session) {
4343
super( entityName, session );
4444
this.identifier = identifier;
45-
//Important optimisation to not actually do a Map lookup for entities which don't have any lazy fields at all:
46-
this.lazyFields = org.hibernate.internal.util.collections.CollectionHelper.toSmallSet( lazyFields );
45+
this.lazyFields = lazyFields;
4746
}
4847

4948
@Override

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import static java.util.Collections.unmodifiableMap;
2222
import static java.util.Collections.unmodifiableSet;
23+
import static org.hibernate.internal.util.collections.CollectionHelper.toSmallSet;
2324

2425
/**
2526
* Information about the bytecode lazy attributes for an entity
@@ -103,8 +104,8 @@ public LazyAttributesMetadata(
103104
this.entityName = entityName;
104105
this.lazyAttributeDescriptorMap = lazyAttributeDescriptorMap;
105106
this.fetchGroupToAttributeMap = fetchGroupToAttributeMap;
106-
this.fetchGroupNames = unmodifiableSet( fetchGroupToAttributeMap.keySet() );
107-
this.lazyAttributeNames = unmodifiableSet( lazyAttributeDescriptorMap.keySet() );
107+
this.fetchGroupNames = toSmallSet( unmodifiableSet( fetchGroupToAttributeMap.keySet() ) );
108+
this.lazyAttributeNames = toSmallSet( unmodifiableSet( lazyAttributeDescriptorMap.keySet() ) );
108109
}
109110

110111
public String getEntityName() {

0 commit comments

Comments
 (0)