HHH-11205 - Added test case.
This commit is contained in:
parent
180f16dbae
commit
1b8d94ddba
|
@ -19,6 +19,8 @@ import org.hibernate.cfg.AvailableSettings;
|
|||
import org.hibernate.dialect.PostgreSQL81Dialect;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.type.CharacterNCharType;
|
||||
import org.hibernate.type.CharacterType;
|
||||
import org.hibernate.type.StringNVarcharType;
|
||||
import org.hibernate.type.StringType;
|
||||
|
||||
|
@ -62,6 +64,32 @@ public class UseNationalizedCharDataSettingTest extends BaseUnitTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-11205" )
|
||||
public void testSettingOnCharType() {
|
||||
final StandardServiceRegistry ssr = new StandardServiceRegistryBuilder()
|
||||
.applySetting( AvailableSettings.USE_NATIONALIZED_CHARACTER_DATA, true )
|
||||
.build();
|
||||
|
||||
try {
|
||||
final MetadataSources ms = new MetadataSources( ssr );
|
||||
ms.addAnnotatedClass( NationalizedBySettingEntity.class );
|
||||
|
||||
final Metadata metadata = ms.buildMetadata();
|
||||
final PersistentClass pc = metadata.getEntityBinding( NationalizedBySettingEntity.class.getName() );
|
||||
final Property nameAttribute = pc.getProperty( "flag" );
|
||||
if(metadata.getDatabase().getDialect() instanceof PostgreSQL81Dialect ){
|
||||
assertSame( CharacterType.INSTANCE, nameAttribute.getType() );
|
||||
}else {
|
||||
assertSame( CharacterNCharType.INSTANCE, nameAttribute.getType() );
|
||||
}
|
||||
|
||||
}
|
||||
finally {
|
||||
StandardServiceRegistryBuilder.destroy( ssr );
|
||||
}
|
||||
}
|
||||
|
||||
@Entity(name = "NationalizedBySettingEntity")
|
||||
@Table(name = "nationalized_by_setting_entity")
|
||||
public static class NationalizedBySettingEntity {
|
||||
|
@ -70,5 +98,6 @@ public class UseNationalizedCharDataSettingTest extends BaseUnitTestCase {
|
|||
private long id;
|
||||
|
||||
String name;
|
||||
char flag;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue