Search in sources :

Example 6 with TypeConfiguration

use of org.hibernate.type.spi.TypeConfiguration in project hibernate-orm by hibernate.

the class JavaTypeDescriptorRegistryTest method testAddDirectlyToJavaTypeDescriptorRegistry.

@Test
public void testAddDirectlyToJavaTypeDescriptorRegistry() {
    TypeConfiguration typeConfiguration = new TypeConfiguration();
    org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry.INSTANCE.addDescriptor(new CustomJavaTypeDescriptor());
    JavaTypeDescriptor descriptor = typeConfiguration.getJavaTypeDescriptorRegistry().getDescriptor(CustomType.class);
    assertThat(descriptor, instanceOf(CustomJavaTypeDescriptor.class));
}
Also used : TypeConfiguration(org.hibernate.type.spi.TypeConfiguration) JavaTypeDescriptor(org.hibernate.type.descriptor.java.JavaTypeDescriptor) Test(org.junit.Test)

Example 7 with TypeConfiguration

use of org.hibernate.type.spi.TypeConfiguration in project hibernate-orm by hibernate.

the class StandardBasicTypeTemplateTest method testContributedBasicType.

@Test
public void testContributedBasicType() {
    TypeConfiguration typeConfiguration = new TypeConfiguration();
    typeConfiguration.getJavaTypeDescriptorRegistry().addDescriptor(ValidatingUrlJavaTypeDescriptor.INSTANCE);
    typeConfiguration.getBasicTypeRegistry().register(new StandardBasicTypeTemplate<>(VarcharTypeDescriptor.INSTANCE, ValidatingUrlJavaTypeDescriptor.INSTANCE, REG_KEY));
    final BasicType registeredType = typeConfiguration.getBasicTypeRegistry().getRegisteredType(REG_KEY);
    assertThat(registeredType, notNullValue());
    assertTyping(StandardBasicTypeTemplate.class, registeredType);
}
Also used : BasicType(org.hibernate.type.BasicType) TypeConfiguration(org.hibernate.type.spi.TypeConfiguration) Test(org.junit.Test)

Aggregations

TypeConfiguration (org.hibernate.type.spi.TypeConfiguration)7 Test (org.junit.Test)7 MetadataSources (org.hibernate.boot.MetadataSources)3 StandardServiceRegistry (org.hibernate.boot.registry.StandardServiceRegistry)3 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)3 MetadataBuilderImplementor (org.hibernate.boot.spi.MetadataBuilderImplementor)3 JavaTypeDescriptor (org.hibernate.type.descriptor.java.JavaTypeDescriptor)2 Geometry (org.geolatte.geom.Geometry)1 SessionFactoryImplementor (org.hibernate.engine.spi.SessionFactoryImplementor)1 JpaAttributeConverter (org.hibernate.metamodel.model.convert.spi.JpaAttributeConverter)1 EntityPersister (org.hibernate.persister.entity.EntityPersister)1 BasicType (org.hibernate.type.BasicType)1 AttributeConverterTypeAdapter (org.hibernate.type.descriptor.converter.AttributeConverterTypeAdapter)1 StringTypeDescriptor (org.hibernate.type.descriptor.java.StringTypeDescriptor)1