HHH-9955 - EnumType mapped via hbm.xml not always resolved properly as far as named/ordinal
This commit is contained in:
parent
ff4774ad7e
commit
1f9b1c00f6
|
@ -17,7 +17,6 @@ import org.hibernate.type.CustomType;
|
|||
import org.hibernate.type.EnumType;
|
||||
import org.hibernate.type.SerializableToBlobType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.usertype.DynamicParameterizedType;
|
||||
|
||||
import org.dom4j.Element;
|
||||
|
||||
|
@ -109,14 +108,10 @@ public final class BasicMetadataGenerator {
|
|||
)
|
||||
);
|
||||
}
|
||||
else if ( parameters.get( DynamicParameterizedType.XPROPERTY ) != null ) {
|
||||
// Case of annotations.
|
||||
else {
|
||||
parent.addElement( "param" ).addAttribute( "name", EnumType.NAMED )
|
||||
.setText( "" + !((EnumType) ((CustomType) type).getUserType()).isOrdinal() );
|
||||
}
|
||||
// Otherwise we assume that the choice between ordinal and named representation has been omitted.
|
||||
// Call to EnumType#isOrdinal() would always return the default Types.INTEGER. We let Hibernate
|
||||
// to choose the proper strategy during runtime.
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
|
|
|
@ -68,11 +68,11 @@ public class UnspecifiedEnumTypeTest extends BaseEnversFunctionalTestCase {
|
|||
private void createSchema(Session session) {
|
||||
executeUpdateSafety(
|
||||
session,
|
||||
"create table ENUM_ENTITY (ID bigint not null, enum1 varchar(255), enum2 integer, primary key (ID))"
|
||||
"create table ENUM_ENTITY (ID bigint not null, enum1 integer, enum2 integer, primary key (ID))"
|
||||
);
|
||||
executeUpdateSafety(
|
||||
session,
|
||||
"create table ENUM_ENTITY_AUD (ID bigint not null, REV integer not null, REVTYPE tinyint, enum1 varchar(255), enum2 integer, primary key (ID, REV))"
|
||||
"create table ENUM_ENTITY_AUD (ID bigint not null, REV integer not null, REVTYPE tinyint, enum1 integer, enum2 integer, primary key (ID, REV))"
|
||||
);
|
||||
executeUpdateSafety(
|
||||
session,
|
||||
|
@ -159,7 +159,7 @@ public class UnspecifiedEnumTypeTest extends BaseEnversFunctionalTestCase {
|
|||
|
||||
Assert.assertNotNull( values );
|
||||
Assert.assertEquals( 2, values.size() );
|
||||
Assert.assertArrayEquals( new Object[] {"X", 0}, values.get( 0 ) );
|
||||
Assert.assertArrayEquals( new Object[] {"Y", 1}, values.get( 1 ) );
|
||||
Assert.assertArrayEquals( new Object[] {0, 0}, values.get( 0 ) );
|
||||
Assert.assertArrayEquals( new Object[] {1, 1}, values.get( 1 ) );
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue