use of org.hibernate.type.descriptor.java.UUIDJavaType in project hibernate-orm by hibernate.
the class BasicTypeRegistryTest method testOverriding.
@Test
public void testOverriding() {
TypeConfiguration typeConfiguration = new TypeConfiguration();
BasicTypeRegistry registry = typeConfiguration.getBasicTypeRegistry();
BasicType<?> uuidBinaryRegistration = registry.getRegisteredType("uuid-binary");
assertTrue(uuidBinaryRegistration.getJavaTypeDescriptor() instanceof UUIDJavaType);
assertTrue(uuidBinaryRegistration.getJdbcType() instanceof BinaryJdbcType);
final BasicType<UUID> uuidRegistration = registry.getRegisteredType(UUID.class.getName());
assertTrue(uuidRegistration.getJavaTypeDescriptor() instanceof UUIDJavaType);
assertTrue(uuidRegistration.getJdbcType() instanceof ObjectJdbcType);
final BasicType<?> override = new BasicTypeImpl<>(UUIDJavaType.INSTANCE, CharJdbcType.INSTANCE);
registry.register(override, UUID.class.getName());
final BasicType<Object> overrideRegistration = registry.getRegisteredType(UUID.class.getName());
assertSame(override, overrideRegistration);
assertNotSame(uuidBinaryRegistration, overrideRegistration);
assertNotSame(uuidRegistration, overrideRegistration);
}
Aggregations