diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/ToOneAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/ToOneAttributeSourceImpl.java index af337bcd98..a6acab899b 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/ToOneAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/ToOneAttributeSourceImpl.java @@ -24,6 +24,7 @@ package org.hibernate.metamodel.internal.source.annotations; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Set; @@ -82,11 +83,15 @@ public class ToOneAttributeSourceImpl extends SingularAttributeSourceImpl implem @Override public List relationalValueSources() { - List valueSources = new ArrayList(); - if ( !associationAttribute.getJoinColumnValues().isEmpty() ) { - for ( Column columnValues : associationAttribute.getJoinColumnValues() ) { - valueSources.add( new ColumnSourceImpl( associationAttribute, null, columnValues ) ); - } + if ( associationAttribute.getJoinColumnValues().isEmpty() ) { + return Collections.emptyList(); + } + List valueSources = new ArrayList( + associationAttribute.getJoinColumnValues() + .size() + ); + for ( Column columnValues : associationAttribute.getJoinColumnValues() ) { + valueSources.add( new ColumnSourceImpl( associationAttribute, null, columnValues ) ); } return valueSources; }