Java Examples for org.hibernate.type.CharacterType

The following java examples will help you to understand the usage of org.hibernate.type.CharacterType. These source code samples are taken from different open source projects.

Example 1
Project: hibernate-orm-master  File: SimpleNationalizedTest.java View source code
@Test
public void simpleNationalizedTest() {
    final StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().build();
    try {
        final MetadataSources ms = new MetadataSources(ssr);
        ms.addAnnotatedClass(NationalizedEntity.class);
        final Metadata metadata = ms.buildMetadata();
        PersistentClass pc = metadata.getEntityBinding(NationalizedEntity.class.getName());
        assertNotNull(pc);
        Property prop = pc.getProperty("nvarcharAtt");
        if (metadata.getDatabase().getDialect() instanceof PostgreSQL81Dialect) {
            // See issue HHH-10693
            assertSame(StringType.INSTANCE, prop.getType());
        } else {
            assertSame(StringNVarcharType.INSTANCE, prop.getType());
        }
        prop = pc.getProperty("materializedNclobAtt");
        if (metadata.getDatabase().getDialect() instanceof PostgreSQL81Dialect) {
            // See issue HHH-10693
            assertSame(MaterializedClobType.INSTANCE, prop.getType());
        } else {
            assertSame(MaterializedNClobType.INSTANCE, prop.getType());
        }
        prop = pc.getProperty("nclobAtt");
        assertSame(NClobType.INSTANCE, prop.getType());
        prop = pc.getProperty("nlongvarcharcharAtt");
        assertSame(NTextType.INSTANCE, prop.getType());
        prop = pc.getProperty("ncharArrAtt");
        if (metadata.getDatabase().getDialect() instanceof PostgreSQL81Dialect) {
            // See issue HHH-10693
            assertSame(CharacterArrayType.INSTANCE, prop.getType());
        } else {
            assertSame(StringNVarcharType.INSTANCE, prop.getType());
        }
        prop = pc.getProperty("ncharacterAtt");
        if (metadata.getDatabase().getDialect() instanceof PostgreSQL81Dialect) {
            // See issue HHH-10693
            assertSame(CharacterType.INSTANCE, prop.getType());
        } else {
            assertSame(CharacterNCharType.INSTANCE, prop.getType());
        }
    } finally {
        StandardServiceRegistryBuilder.destroy(ssr);
    }
}