Search in sources :

Example 1 with UUIDCharType

use of org.hibernate.type.UUIDCharType in project hibernate-orm by hibernate.

the class BasicTypeRegistryTest method testOverriding.

@Test
public void testOverriding() {
    BasicTypeRegistry registry = new BasicTypeRegistry();
    BasicType type = registry.getRegisteredType("uuid-binary");
    assertSame(UUIDBinaryType.INSTANCE, type);
    type = registry.getRegisteredType(UUID.class.getName());
    assertSame(UUIDBinaryType.INSTANCE, type);
    BasicType override = new UUIDCharType() {

        @Override
        protected boolean registerUnderJavaType() {
            return true;
        }
    };
    registry.register(override);
    type = registry.getRegisteredType(UUID.class.getName());
    assertNotSame(UUIDBinaryType.INSTANCE, type);
    assertSame(override, type);
}
Also used : BasicType(org.hibernate.type.BasicType) AbstractSingleColumnStandardBasicType(org.hibernate.type.AbstractSingleColumnStandardBasicType) BasicTypeRegistry(org.hibernate.type.BasicTypeRegistry) UUIDCharType(org.hibernate.type.UUIDCharType) Test(org.junit.Test)

Aggregations

AbstractSingleColumnStandardBasicType (org.hibernate.type.AbstractSingleColumnStandardBasicType)1 BasicType (org.hibernate.type.BasicType)1 BasicTypeRegistry (org.hibernate.type.BasicTypeRegistry)1 UUIDCharType (org.hibernate.type.UUIDCharType)1 Test (org.junit.Test)1