Search in sources :

Example 11 with JavaTypeRegistry

use of org.hibernate.type.descriptor.java.spi.JavaTypeRegistry in project hibernate-orm by hibernate.

the class MLEntity method testSimpleEntity.

@Test
public void testSimpleEntity(SessionFactoryScope scope) {
    final EntityPersister entityDescriptor = scope.getSessionFactory().getRuntimeMetamodels().getMappingMetamodel().getEntityDescriptor(MLEntity.class);
    final JdbcTypeRegistry jdbcTypeRegistry = entityDescriptor.getFactory().getTypeConfiguration().getJdbcTypeRegistry();
    final JavaTypeRegistry javaTypeRegistry = entityDescriptor.getFactory().getTypeConfiguration().getJavaTypeRegistry();
    ModelPart part = entityDescriptor.findSubPart("lineString");
    assertThat(part.getJavaType(), equalTo(GeolatteGeometryJavaType.MULTILINESTRING_INSTANCE));
}
Also used : EntityPersister(org.hibernate.persister.entity.EntityPersister) JavaTypeRegistry(org.hibernate.type.descriptor.java.spi.JavaTypeRegistry) ModelPart(org.hibernate.metamodel.mapping.ModelPart) JdbcTypeRegistry(org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry) Test(org.junit.jupiter.api.Test)

Example 12 with JavaTypeRegistry

use of org.hibernate.type.descriptor.java.spi.JavaTypeRegistry in project hibernate-orm by hibernate.

the class JavaTypeRegistryTest method testRegisterJavaTypeDescriptorRegistry.

@Test
public void testRegisterJavaTypeDescriptorRegistry() {
    final TypeConfiguration typeConfiguration = new TypeConfiguration();
    final JavaTypeRegistry registry = new JavaTypeRegistry(typeConfiguration);
    registry.addDescriptor(new CustomJavaType());
    final JavaType<?> descriptor = registry.getDescriptor(CustomType.class);
    assertThat(descriptor, instanceOf(CustomJavaType.class));
}
Also used : JavaTypeRegistry(org.hibernate.type.descriptor.java.spi.JavaTypeRegistry) TypeConfiguration(org.hibernate.type.spi.TypeConfiguration) Test(org.junit.Test)

Aggregations

JavaTypeRegistry (org.hibernate.type.descriptor.java.spi.JavaTypeRegistry)12 TypeConfiguration (org.hibernate.type.spi.TypeConfiguration)7 SessionFactoryImplementor (org.hibernate.engine.spi.SessionFactoryImplementor)3 EntityPersister (org.hibernate.persister.entity.EntityPersister)3 List (java.util.List)2 NotYetImplementedFor6Exception (org.hibernate.NotYetImplementedFor6Exception)2 Dialect (org.hibernate.dialect.Dialect)2 BasicValue (org.hibernate.mapping.BasicValue)2 CollectionPart (org.hibernate.metamodel.mapping.CollectionPart)2 SelectableMapping (org.hibernate.metamodel.mapping.SelectableMapping)2 JdbcTypeRegistry (org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry)2 BigInteger (java.math.BigInteger)1 OffsetDateTime (java.time.OffsetDateTime)1 ZonedDateTime (java.time.ZonedDateTime)1 ArrayList (java.util.ArrayList)1 SortedMap (java.util.SortedMap)1 SortedSet (java.util.SortedSet)1 MappingException (org.hibernate.MappingException)1 MapKeyJavaType (org.hibernate.annotations.MapKeyJavaType)1 MapKeyJdbcType (org.hibernate.annotations.MapKeyJdbcType)1