From 279326fe6d20b1de04103146ae201f0fb58f8b65 Mon Sep 17 00:00:00 2001 From: Strong Liu Date: Thu, 13 Sep 2012 14:23:53 +0800 Subject: [PATCH] HHH-7549 @OneToMany --- .../annotations/ToOneAttributeSourceImpl.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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; }