HHH-6560 : Discriminator match value is not initialized in root EntityBinding

This commit is contained in:
Gail Badner 2011-08-08 12:46:43 -07:00
parent 50ee956d49
commit 5ee60b1ca4
2 changed files with 9 additions and 0 deletions

View File

@ -388,6 +388,7 @@ public class Binder {
discriminator.setForced( discriminatorSource.isForced() );
entityBinding.getHierarchyDetails().setEntityDiscriminator( discriminator );
entityBinding.setDiscriminatorMatchValue( entitySource.getDiscriminatorMatchValue() );
}
private void bindDiscriminatorValue(SubclassEntitySource entitySource, EntityBinding entityBinding) {

View File

@ -287,6 +287,13 @@ public class InheritanceBindingTest extends BaseAnnotationBindingTestCase {
assertFalse( "Wrong default value", discriminator.isInserted() );
}
@Test
@Resources(annotatedClasses = { Base.class, Jump.class })
public void testRootDiscriminatorMatchValue() {
EntityBinding rootEntityBinding = getEntityBinding( Base.class );
assertEquals( "base", rootEntityBinding.getDiscriminatorMatchValue() );
}
@Test
@Resources(annotatedClasses = { Fruit.class, Apple.class })
public void testDiscriminatorFormula() {
@ -336,6 +343,7 @@ public class InheritanceBindingTest extends BaseAnnotationBindingTestCase {
}
@Entity
@DiscriminatorValue("base")
@DiscriminatorOptions(force = true, insert = false)
class Base {
@Id