Skip to content

Commit 2758cb3

Browse files
committed
Ensure EntityMetamodel#idAttributeNames is minimized
1 parent 92a3ec2 commit 2758cb3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import org.checkerframework.checker.nullness.qual.Nullable;
6060

6161
import static java.util.Collections.singleton;
62+
import static java.util.Collections.unmodifiableSet;
6263
import static org.hibernate.internal.CoreLogging.messageLogger;
6364
import static org.hibernate.internal.util.ReflectHelper.isAbstractClass;
6465
import static org.hibernate.internal.util.ReflectHelper.isFinalClass;
@@ -193,10 +194,11 @@ public EntityMetamodel(
193194
final Set<String> idAttributeNames;
194195
if ( identifierMapperComponent != null ) {
195196
nonAggregatedCidMapper = identifierMapperComponent.getType();
196-
idAttributeNames = new HashSet<>( );
197+
HashSet<String> tmpSet = new HashSet<>();
197198
for ( Property property : identifierMapperComponent.getProperties() ) {
198-
idAttributeNames.add( property.getName() );
199+
tmpSet.add( property.getName() );
199200
}
201+
idAttributeNames = toSmallSet( unmodifiableSet( tmpSet ) );
200202
}
201203
else {
202204
nonAggregatedCidMapper = null;

0 commit comments

Comments
 (0)