HHH-10888 : PluralAttribute#isAssociation returns true for @ElementCollection

This commit is contained in:
Gail Badner 2016-06-23 14:10:37 -07:00
parent da4f5e1a57
commit cdd7fb66c8
3 changed files with 4 additions and 3 deletions

View File

@ -153,7 +153,8 @@ public abstract class PluralAttributeImpl<X, C, E>
@Override
public boolean isAssociation() {
return true;
return getPersistentAttributeType() == PersistentAttributeType.ONE_TO_MANY
|| getPersistentAttributeType() == PersistentAttributeType.MANY_TO_MANY;
}
@Override

View File

@ -273,7 +273,7 @@ public class MetadataTest extends BaseEntityManagerFunctionalTestCase {
final EntityType<House> entityType = entityManagerFactory().getMetamodel().entity( House.class );
final SetAttribute<House,Room> rooms = entityType.getDeclaredSet( "rooms", Room.class );
assertNotNull( rooms );
assertTrue( rooms.isAssociation() );
assertFalse( rooms.isAssociation() );
assertTrue( rooms.isCollection() );
assertEquals( Attribute.PersistentAttributeType.ELEMENT_COLLECTION, rooms.getPersistentAttributeType() );
assertEquals( Room.class, rooms.getBindableJavaType() );

View File

@ -87,7 +87,7 @@ public class StaticMetadataTest extends BaseEntityManagerFunctionalTestCase {
assertFalse( House_.address.isCollection() );
assertFalse( House_.address.isAssociation() );
assertNotNull( House_.rooms );
assertTrue( House_.rooms.isAssociation() );
assertFalse( House_.rooms.isAssociation() );
assertTrue( House_.rooms.isCollection() );
assertEquals( Attribute.PersistentAttributeType.ELEMENT_COLLECTION, House_.rooms.getPersistentAttributeType() );
assertEquals( Room.class, House_.rooms.getBindableJavaType() );