HHH-7549 @OneToMany

This commit is contained in:
Strong Liu 2012-09-13 14:23:53 +08:00
parent 11270a0f12
commit 279326fe6d
1 changed files with 10 additions and 5 deletions

View File

@ -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<RelationalValueSource> relationalValueSources() {
List<RelationalValueSource> valueSources = new ArrayList<RelationalValueSource>();
if ( !associationAttribute.getJoinColumnValues().isEmpty() ) {
for ( Column columnValues : associationAttribute.getJoinColumnValues() ) {
valueSources.add( new ColumnSourceImpl( associationAttribute, null, columnValues ) );
}
if ( associationAttribute.getJoinColumnValues().isEmpty() ) {
return Collections.emptyList();
}
List<RelationalValueSource> valueSources = new ArrayList<RelationalValueSource>(
associationAttribute.getJoinColumnValues()
.size()
);
for ( Column columnValues : associationAttribute.getJoinColumnValues() ) {
valueSources.add( new ColumnSourceImpl( associationAttribute, null, columnValues ) );
}
return valueSources;
}