HHH-6500 : EntityBinding.getEntity().getSuperType() is null for subclass EntityBinding

This commit is contained in:
Gail Badner 2011-07-27 21:35:58 -07:00
parent b2692620d7
commit ac7feff33a
2 changed files with 19 additions and 1 deletions

View File

@ -201,7 +201,7 @@ public class Binder {
entityName,
className,
currentBindingContext.makeClassReference( className ),
null
superEntityBinding == null ? null : superEntityBinding.getEntity()
);
entityBinding.setEntity( entity );

View File

@ -36,6 +36,7 @@ import org.hibernate.metamodel.binding.EntityDiscriminator;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertSame;
import static junit.framework.Assert.assertTrue;
@ -58,6 +59,23 @@ public class InheritanceBindingTest extends BaseAnnotationBindingTestCase {
assertEquals( "Wrong discriminator value", "foo", entityBinding.getDiscriminatorMatchValue() );
}
@Test
@Resources(annotatedClasses = { RootOfSingleTableInheritance.class, SubclassOfSingleTableInheritance.class })
public void testSubclassEntitySuperType() {
EntityBinding entityBinding = getEntityBinding( SubclassOfSingleTableInheritance.class );
assertNotNull( entityBinding.getEntity().getSuperType() );
assertSame( RootOfSingleTableInheritance.class, entityBinding.getEntity().getSuperType().getClassReference() );
assertEquals( RootOfSingleTableInheritance.class.getName(), entityBinding.getEntity().getSuperType().getClassName() );
assertNull( entityBinding.getEntity().getSuperType().getSuperType() );
}
@Test
@Resources(annotatedClasses = { RootOfSingleTableInheritance.class, SubclassOfSingleTableInheritance.class })
public void testRootEntitySuperType() {
EntityBinding entityBinding = getEntityBinding( RootOfSingleTableInheritance.class );
assertNull( entityBinding.getEntity().getSuperType() );
}
@Test
@Resources(annotatedClasses = {
SubclassOfSingleTableInheritance.class,