HHH-7744 @DiscriminatorColumn's default discriminatorType ignored

This commit is contained in:
brmeyer 2012-10-30 16:51:49 -04:00
parent 367d331fd7
commit d271ad7e6a
3 changed files with 7 additions and 11 deletions

View File

@ -222,10 +222,9 @@ public class RootEntityClass extends EntityClass {
discriminatorColumnValues = new Column( null ); //(stliu) give null here, will populate values below discriminatorColumnValues = new Column( null ); //(stliu) give null here, will populate values below
discriminatorColumnValues.setNullable( false ); // discriminator column cannot be null discriminatorColumnValues.setNullable( false ); // discriminator column cannot be null
if ( discriminatorColumnAnnotation != null ) { if ( discriminatorColumnAnnotation != null ) {
DiscriminatorType discriminatorType = JandexHelper.getValue(
DiscriminatorType discriminatorType = Enum.valueOf( discriminatorColumnAnnotation,
DiscriminatorType.class, discriminatorColumnAnnotation.value( "discriminatorType" ).asEnum() "discriminatorType", DiscriminatorType.class );
);
switch ( discriminatorType ) { switch ( discriminatorType ) {
case STRING: { case STRING: {
type = String.class; type = String.class;

View File

@ -23,7 +23,8 @@
*/ */
package org.hibernate.test.annotations.id; package org.hibernate.test.annotations.id;
import org.junit.Test; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.Transaction; import org.hibernate.Transaction;
@ -46,17 +47,13 @@ import org.hibernate.test.annotations.id.entities.SoundSystem;
import org.hibernate.test.annotations.id.entities.Store; import org.hibernate.test.annotations.id.entities.Store;
import org.hibernate.test.annotations.id.entities.Tree; import org.hibernate.test.annotations.id.entities.Tree;
import org.hibernate.test.util.SchemaUtil; import org.hibernate.test.util.SchemaUtil;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/** /**
* @author Emmanuel Bernard * @author Emmanuel Bernard
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@FailureExpectedWithNewMetamodel
public class IdTest extends BaseCoreFunctionalTestCase { public class IdTest extends BaseCoreFunctionalTestCase {
@Test @Test
public void testGenericGenerator() throws Exception { public void testGenericGenerator() throws Exception {

View File

@ -10,7 +10,7 @@ import javax.persistence.IdClass;
*/ */
@Entity @Entity
@IdClass(FootballerPk.class) @IdClass(FootballerPk.class)
@DiscriminatorColumn(name = "bibi") @DiscriminatorColumn( name = "bibi", length = 53 )
public class Footballer { public class Footballer {
private String firstname; private String firstname;
private String lastname; private String lastname;