HHH-12444 - Introduce BootstrapContext
HHH-12443 - Introduce TypeConfiguration
This commit is contained in:
parent
cb6871ff40
commit
0d82dc7c83
|
@ -84,7 +84,6 @@ public class BootstrapContextImpl implements BootstrapContext {
|
|||
this.classLoaderAccess = new ClassLoaderAccessImpl( classLoaderService );
|
||||
this.hcannReflectionManager = generateHcannReflectionManager();
|
||||
|
||||
|
||||
final StrategySelector strategySelector = serviceRegistry.getService( StrategySelector.class );
|
||||
final ConfigurationService configService = serviceRegistry.getService( ConfigurationService.class );
|
||||
|
||||
|
|
|
@ -69,7 +69,11 @@ import org.hibernate.internal.CoreMessageLogger;
|
|||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.type.AbstractStandardBasicType;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
import org.hibernate.usertype.CompositeUserType;
|
||||
import org.hibernate.usertype.UserType;
|
||||
|
||||
|
@ -289,6 +293,21 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
|
|||
options.basicTypeRegistrations.add( new BasicTypeRegistration( type, keys ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contributeJavaTypeDescriptor(JavaTypeDescriptor descriptor) {
|
||||
this.bootstrapContext.getTypeConfiguration().getJavaTypeDescriptorRegistry().addDescriptor( descriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contributeSqlTypeDescriptor(SqlTypeDescriptor descriptor) {
|
||||
this.bootstrapContext.getTypeConfiguration().getSqlTypeDescriptorRegistry().addDescriptor( descriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeConfiguration getTypeConfiguration() {
|
||||
return bootstrapContext.getTypeConfiguration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MetadataBuilder applyCacheRegionDefinition(CacheRegionDefinition cacheRegionDefinition) {
|
||||
this.bootstrapContext.addCacheRegionDefinition( cacheRegionDefinition );
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
package org.hibernate.boot.model;
|
||||
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
import org.hibernate.usertype.CompositeUserType;
|
||||
import org.hibernate.usertype.UserType;
|
||||
|
||||
|
@ -23,4 +26,14 @@ public interface TypeContributions {
|
|||
void contributeType(UserType type, String... keys);
|
||||
|
||||
void contributeType(CompositeUserType type, String... keys);
|
||||
|
||||
/*
|
||||
* Add the JavaTypeDescriptor to the
|
||||
* @param descriptor
|
||||
*/
|
||||
void contributeJavaTypeDescriptor(JavaTypeDescriptor descriptor);
|
||||
|
||||
void contributeSqlTypeDescriptor(SqlTypeDescriptor descriptor);
|
||||
|
||||
TypeConfiguration getTypeConfiguration();
|
||||
}
|
||||
|
|
|
@ -23,5 +23,5 @@ public interface TypeContributor {
|
|||
* @param typeContributions The callback for adding contributed types
|
||||
* @param serviceRegistry The service registry
|
||||
*/
|
||||
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry);
|
||||
void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,9 @@ import org.hibernate.dialect.Dialect;
|
|||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.BasicTypeRegistry;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
import org.hibernate.usertype.CompositeUserType;
|
||||
import org.hibernate.usertype.UserType;
|
||||
|
||||
|
@ -348,6 +351,21 @@ public class MetadataBuildingProcess {
|
|||
getBasicTypeRegistry().register( type, keys );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contributeJavaTypeDescriptor(JavaTypeDescriptor descriptor) {
|
||||
bootstrapContext.getTypeConfiguration().getJavaTypeDescriptorRegistry().addDescriptor( descriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contributeSqlTypeDescriptor(SqlTypeDescriptor descriptor) {
|
||||
bootstrapContext.getTypeConfiguration().getSqlTypeDescriptorRegistry().addDescriptor( descriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeConfiguration getTypeConfiguration() {
|
||||
return bootstrapContext.getTypeConfiguration();
|
||||
}
|
||||
|
||||
final BasicTypeRegistry getBasicTypeRegistry() {
|
||||
return bootstrapContext.getTypeConfiguration().getBasicTypeRegistry();
|
||||
}
|
||||
|
@ -371,7 +389,4 @@ public class MetadataBuildingProcess {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ public abstract class AbstractDelegatingSessionFactoryBuilderImplementor<T exten
|
|||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
||||
@Override
|
||||
public void markAsJpaBootstrap() {
|
||||
delegate().markAsJpaBootstrap();
|
||||
|
|
|
@ -84,7 +84,7 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
|
|||
protected final SessionImplementor delegate;
|
||||
|
||||
/**
|
||||
* @deprecated (since 6.0) SessionDelegatorBaseImpl should take just one argument, the SessionImplementor.
|
||||
* @deprecated (since 5.3) SessionDelegatorBaseImpl should take just one argument, the SessionImplementor.
|
||||
* Use the {@link #SessionDelegatorBaseImpl(SessionImplementor)} form instead
|
||||
*/
|
||||
@Deprecated
|
||||
|
|
|
@ -161,7 +161,7 @@ public interface SharedSessionContractImplementor
|
|||
long getTransactionStartTimestamp();
|
||||
|
||||
/**
|
||||
* @deprecated (since 6.0) Use
|
||||
* @deprecated (since 5.3) Use
|
||||
*/
|
||||
@Deprecated
|
||||
default long getTimestamp() {
|
||||
|
|
|
@ -91,6 +91,7 @@ public abstract class Collection implements Fetchable, Value, Filterable {
|
|||
|
||||
protected Collection(MetadataBuildingContext buildingContext, PersistentClass owner) {
|
||||
this(buildingContext.getMetadataCollector(), owner);
|
||||
this.buildingContext = buildingContext;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,6 +57,7 @@ import org.hibernate.type.descriptor.sql.LobTypeMappings;
|
|||
import org.hibernate.type.descriptor.sql.NationalizedTypeMappings;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorRegistry;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
import org.hibernate.usertype.DynamicParameterizedType;
|
||||
|
||||
/**
|
||||
|
@ -69,11 +70,11 @@ public class SimpleValue implements KeyValue {
|
|||
public static final String DEFAULT_ID_GEN_STRATEGY = "assigned";
|
||||
|
||||
private MetadataBuildingContext buildingContext;
|
||||
private MetadataImplementor metadata;
|
||||
private final MetadataImplementor metadata;
|
||||
|
||||
private final List<Selectable> columns = new ArrayList<Selectable>();
|
||||
private final List<Boolean> insertability = new ArrayList<Boolean>();
|
||||
private final List<Boolean> updatability = new ArrayList<Boolean>();
|
||||
private final List<Selectable> columns = new ArrayList<>();
|
||||
private final List<Boolean> insertability = new ArrayList<>();
|
||||
private final List<Boolean> updatability = new ArrayList<>();
|
||||
|
||||
private String typeName;
|
||||
private Properties typeParameters;
|
||||
|
@ -112,6 +113,7 @@ public class SimpleValue implements KeyValue {
|
|||
|
||||
public SimpleValue(MetadataBuildingContext buildingContext) {
|
||||
this(buildingContext.getMetadataCollector());
|
||||
this.buildingContext = buildingContext;
|
||||
}
|
||||
|
||||
public SimpleValue(MetadataBuildingContext buildingContext, Table table) {
|
||||
|
@ -575,7 +577,7 @@ public class SimpleValue implements KeyValue {
|
|||
|
||||
@Override
|
||||
public JavaTypeDescriptorRegistry getJavaTypeDescriptorRegistry() {
|
||||
return JavaTypeDescriptorRegistry.INSTANCE;
|
||||
return metadata.getTypeConfiguration().getJavaTypeDescriptorRegistry();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -621,7 +623,10 @@ public class SimpleValue implements KeyValue {
|
|||
.getService( JdbcServices.class )
|
||||
.getJdbcEnvironment()
|
||||
.getDialect()
|
||||
.remapSqlTypeDescriptor( SqlTypeDescriptorRegistry.INSTANCE.getDescriptor( jdbcTypeCode ) );
|
||||
.remapSqlTypeDescriptor(
|
||||
metadata.getTypeConfiguration()
|
||||
.getSqlTypeDescriptorRegistry()
|
||||
.getDescriptor( jdbcTypeCode ) );
|
||||
|
||||
// and finally construct the adapter, which injects the AttributeConverter calls into the binding/extraction
|
||||
// process...
|
||||
|
|
|
@ -28,7 +28,8 @@ import org.hibernate.metamodel.model.convert.internal.NamedEnumValueConverter;
|
|||
import org.hibernate.metamodel.model.convert.internal.OrdinalEnumValueConverter;
|
||||
import org.hibernate.metamodel.model.convert.spi.EnumValueConverter;
|
||||
import org.hibernate.type.descriptor.java.EnumJavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
import org.hibernate.type.spi.TypeConfigurationAware;
|
||||
import org.hibernate.usertype.DynamicParameterizedType;
|
||||
import org.hibernate.usertype.EnhancedUserType;
|
||||
import org.hibernate.usertype.LoggableUserType;
|
||||
|
@ -58,7 +59,8 @@ import org.jboss.logging.Logger;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class EnumType<T extends Enum> implements EnhancedUserType, DynamicParameterizedType,LoggableUserType, Serializable {
|
||||
public class EnumType<T extends Enum>
|
||||
implements EnhancedUserType, DynamicParameterizedType, LoggableUserType, TypeConfigurationAware, Serializable {
|
||||
private static final Logger LOG = CoreLogging.logger( EnumType.class );
|
||||
|
||||
public static final String ENUM = "enumClass";
|
||||
|
@ -66,8 +68,11 @@ public class EnumType<T extends Enum> implements EnhancedUserType, DynamicParame
|
|||
public static final String TYPE = "type";
|
||||
|
||||
private Class enumClass;
|
||||
|
||||
private EnumValueConverter enumValueConverter;
|
||||
|
||||
private TypeConfiguration typeConfiguration;
|
||||
|
||||
@Override
|
||||
public void setParameterValues(Properties parameters) {
|
||||
// IMPL NOTE: we handle 2 distinct cases here:
|
||||
|
@ -95,7 +100,9 @@ public class EnumType<T extends Enum> implements EnhancedUserType, DynamicParame
|
|||
throw new AssertionFailure( "Unknown EnumType: " + enumType );
|
||||
}
|
||||
|
||||
final EnumJavaTypeDescriptor enumJavaDescriptor = (EnumJavaTypeDescriptor) JavaTypeDescriptorRegistry.INSTANCE.getDescriptor( enumClass );
|
||||
final EnumJavaTypeDescriptor enumJavaDescriptor = (EnumJavaTypeDescriptor) typeConfiguration
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getDescriptor( enumClass );
|
||||
|
||||
if ( isOrdinal ) {
|
||||
this.enumValueConverter = new OrdinalEnumValueConverter( enumJavaDescriptor );
|
||||
|
@ -150,8 +157,9 @@ public class EnumType<T extends Enum> implements EnhancedUserType, DynamicParame
|
|||
}
|
||||
|
||||
private EnumValueConverter interpretParameters(Properties parameters) {
|
||||
final EnumJavaTypeDescriptor javaTypeDescriptor = (EnumJavaTypeDescriptor) JavaTypeDescriptorRegistry.INSTANCE.getDescriptor( enumClass );
|
||||
|
||||
final EnumJavaTypeDescriptor javaTypeDescriptor = (EnumJavaTypeDescriptor) typeConfiguration
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getDescriptor( enumClass );
|
||||
if ( parameters.containsKey( NAMED ) ) {
|
||||
final boolean useNamed = ConfigurationHelper.getBoolean( NAMED, parameters );
|
||||
if ( useNamed ) {
|
||||
|
@ -279,6 +287,16 @@ public class EnumType<T extends Enum> implements EnhancedUserType, DynamicParame
|
|||
return original;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeConfiguration getTypeConfiguration() {
|
||||
return typeConfiguration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTypeConfiguration(TypeConfiguration typeConfiguration) {
|
||||
this.typeConfiguration = typeConfiguration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String objectToSQLString(Object value) {
|
||||
verifyConfigured();
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.hibernate.internal.CoreMessageLogger;
|
|||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.tuple.component.ComponentMetamodel;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
import org.hibernate.type.spi.TypeConfigurationAware;
|
||||
import org.hibernate.usertype.CompositeUserType;
|
||||
import org.hibernate.usertype.ParameterizedType;
|
||||
import org.hibernate.usertype.UserType;
|
||||
|
@ -165,7 +166,17 @@ public final class TypeFactory implements Serializable {
|
|||
}
|
||||
|
||||
public CustomType custom(Class<UserType> typeClass, Properties parameters) {
|
||||
return custom( typeClass, parameters, typeScope );
|
||||
try {
|
||||
UserType userType = typeClass.newInstance();
|
||||
if ( TypeConfigurationAware.class.isInstance( userType ) ) {
|
||||
( (TypeConfigurationAware) userType ).setTypeConfiguration( typeConfiguration );
|
||||
}
|
||||
injectParameters( userType, parameters );
|
||||
return new CustomType( userType );
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new MappingException( "Unable to instantiate custom type: " + typeClass.getName(), e );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -60,7 +60,7 @@ public abstract class AbstractTypeDescriptor<T> implements JavaTypeDescriptor<T>
|
|||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getJavaTypeClass()} instead
|
||||
* @deprecated Use {@link #getJavaType()} instead
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
|
|
|
@ -17,8 +17,7 @@ public class EnumJavaTypeDescriptor<T extends Enum> extends AbstractTypeDescript
|
|||
@SuppressWarnings("unchecked")
|
||||
protected EnumJavaTypeDescriptor(Class<T> type) {
|
||||
super( type, ImmutableMutabilityPlan.INSTANCE );
|
||||
|
||||
JavaTypeDescriptorRegistry.INSTANCE.addDescriptor( this );
|
||||
//JavaTypeDescriptorRegistry.INSTANCE.addDescriptor( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,20 +16,26 @@ import org.hibernate.internal.CoreLogging;
|
|||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
/**
|
||||
* Basically a map from {@link Class} -> {@link JavaTypeDescriptor}
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*
|
||||
* @deprecated Use (5.3) Use {@link org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry} instead
|
||||
*/
|
||||
public class JavaTypeDescriptorRegistry {
|
||||
@Deprecated
|
||||
public class JavaTypeDescriptorRegistry implements Serializable {
|
||||
private static final CoreMessageLogger log = CoreLogging.messageLogger( JavaTypeDescriptorRegistry.class );
|
||||
|
||||
/**
|
||||
* @deprecated (5.3) Use {@link TypeConfiguration#getJavaTypeDescriptorRegistry()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final JavaTypeDescriptorRegistry INSTANCE = new JavaTypeDescriptorRegistry();
|
||||
|
||||
private ConcurrentHashMap<Class,JavaTypeDescriptor> descriptorsByClass = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<Class, JavaTypeDescriptor> descriptorsByClass = new ConcurrentHashMap<>();
|
||||
|
||||
public JavaTypeDescriptorRegistry() {
|
||||
addDescriptorInternal( ByteTypeDescriptor.INSTANCE );
|
||||
|
@ -78,26 +84,34 @@ public class JavaTypeDescriptorRegistry {
|
|||
}
|
||||
|
||||
private JavaTypeDescriptor addDescriptorInternal(JavaTypeDescriptor descriptor) {
|
||||
return descriptorsByClass.put( descriptor.getJavaTypeClass(), descriptor );
|
||||
JavaTypeDescriptor javaTypeDescriptor = descriptorsByClass.put( descriptor.getJavaType(), descriptor );
|
||||
return javaTypeDescriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given descriptor to this registry
|
||||
*
|
||||
* @param descriptor The descriptor to add.
|
||||
*
|
||||
* @deprecated (5.3) Use {@link org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry#addDescriptor(JavaTypeDescriptor)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public void addDescriptor(JavaTypeDescriptor descriptor) {
|
||||
JavaTypeDescriptor old = addDescriptorInternal( descriptor );
|
||||
if ( old != null ) {
|
||||
log.debugf(
|
||||
"JavaTypeDescriptorRegistry entry replaced : %s -> %s (was %s)",
|
||||
descriptor.getJavaTypeClass(),
|
||||
descriptor.getJavaType(),
|
||||
descriptor,
|
||||
old
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated (5.3) Use {@link org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry#getDescriptor(Class)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> JavaTypeDescriptor<T> getDescriptor(Class<T> cls) {
|
||||
if ( cls == null ) {
|
||||
|
@ -116,7 +130,7 @@ public class JavaTypeDescriptorRegistry {
|
|||
}
|
||||
|
||||
// find the first "assignable" match
|
||||
for ( Map.Entry<Class,JavaTypeDescriptor> entry : descriptorsByClass.entrySet() ) {
|
||||
for ( Map.Entry<Class, JavaTypeDescriptor> entry : descriptorsByClass.entrySet() ) {
|
||||
if ( entry.getKey().isAssignableFrom( cls ) ) {
|
||||
log.debugf( "Using cached JavaTypeDescriptor instance for Java class [%s]", cls.getName() );
|
||||
return entry.getValue();
|
||||
|
@ -135,7 +149,7 @@ public class JavaTypeDescriptorRegistry {
|
|||
);
|
||||
checkEqualsAndHashCode( cls );
|
||||
|
||||
return new FallbackJavaTypeDescriptor<T>( cls );
|
||||
return new FallbackJavaTypeDescriptor<>( cls );
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -148,7 +162,7 @@ public class JavaTypeDescriptorRegistry {
|
|||
|
||||
public static class FallbackJavaTypeDescriptor<T> extends AbstractTypeDescriptor<T> {
|
||||
protected FallbackJavaTypeDescriptor(final Class<T> type) {
|
||||
super(type, createMutabilityPlan(type));
|
||||
super( type, createMutabilityPlan( type ) );
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -176,7 +190,7 @@ public class JavaTypeDescriptorRegistry {
|
|||
@Override
|
||||
public T fromString(String string) {
|
||||
throw new HibernateException(
|
||||
"Not known how to convert String to given type [" + getJavaTypeClass().getName() + "]"
|
||||
"Not known how to convert String to given type [" + getJavaType().getName() + "]"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -192,5 +206,4 @@ public class JavaTypeDescriptorRegistry {
|
|||
return (T) value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.type.descriptor.java.spi;
|
||||
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
/**
|
||||
* Basically a map from {@link Class} -> {@link JavaTypeDescriptor}
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
* @author Andrea Boriero
|
||||
*
|
||||
* @since 5.3
|
||||
*/
|
||||
public class JavaTypeDescriptorRegistry extends org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry {
|
||||
|
||||
private TypeConfiguration typeConfiguration;
|
||||
|
||||
public JavaTypeDescriptorRegistry(TypeConfiguration typeConfiguration) {
|
||||
|
||||
this.typeConfiguration = typeConfiguration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> JavaTypeDescriptor<T> getDescriptor(Class<T> javaType) {
|
||||
return super.getDescriptor( javaType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDescriptor(JavaTypeDescriptor descriptor) {
|
||||
super.addDescriptor( descriptor );
|
||||
}
|
||||
}
|
|
@ -26,7 +26,7 @@ public interface SqlTypeDescriptor extends Serializable {
|
|||
*
|
||||
* @return typeCode The JDBC type-code
|
||||
*/
|
||||
public int getSqlType();
|
||||
int getSqlType();
|
||||
|
||||
/**
|
||||
* Is this descriptor available for remapping?
|
||||
|
@ -36,7 +36,7 @@ public interface SqlTypeDescriptor extends Serializable {
|
|||
* @see org.hibernate.type.descriptor.WrapperOptions#remapSqlTypeDescriptor
|
||||
* @see org.hibernate.dialect.Dialect#remapSqlTypeDescriptor
|
||||
*/
|
||||
public boolean canBeRemapped();
|
||||
boolean canBeRemapped();
|
||||
|
||||
/**
|
||||
* Get the binder (setting JDBC in-going parameter values) capable of handling values of the type described by the
|
||||
|
@ -46,7 +46,7 @@ public interface SqlTypeDescriptor extends Serializable {
|
|||
*
|
||||
* @return The appropriate binder.
|
||||
*/
|
||||
public <X> ValueBinder<X> getBinder(JavaTypeDescriptor<X> javaTypeDescriptor);
|
||||
<X> ValueBinder<X> getBinder(JavaTypeDescriptor<X> javaTypeDescriptor);
|
||||
|
||||
/**
|
||||
* Get the extractor (pulling out-going values from JDBC objects) capable of handling values of the type described
|
||||
|
@ -56,5 +56,5 @@ public interface SqlTypeDescriptor extends Serializable {
|
|||
*
|
||||
* @return The appropriate extractor
|
||||
*/
|
||||
public <X> ValueExtractor<X> getExtractor(JavaTypeDescriptor<X> javaTypeDescriptor);
|
||||
<X> ValueExtractor<X> getExtractor(JavaTypeDescriptor<X> javaTypeDescriptor);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.hibernate.type.descriptor.ValueBinder;
|
|||
import org.hibernate.type.descriptor.ValueExtractor;
|
||||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
|
@ -25,15 +26,23 @@ import org.jboss.logging.Logger;
|
|||
* Basically a map from JDBC type code (int) -> {@link SqlTypeDescriptor}
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*
|
||||
* @deprecated (5.3) Use {@link org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry} instead.
|
||||
*/
|
||||
public class SqlTypeDescriptorRegistry {
|
||||
@Deprecated
|
||||
public class SqlTypeDescriptorRegistry implements Serializable {
|
||||
|
||||
/**
|
||||
* @deprecated (5.3) Use {@link TypeConfiguration#getSqlTypeDescriptorRegistry()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final SqlTypeDescriptorRegistry INSTANCE = new SqlTypeDescriptorRegistry();
|
||||
|
||||
private static final Logger log = Logger.getLogger( SqlTypeDescriptorRegistry.class );
|
||||
|
||||
private ConcurrentHashMap<Integer,SqlTypeDescriptor> descriptorMap = new ConcurrentHashMap<Integer, SqlTypeDescriptor>();
|
||||
|
||||
private SqlTypeDescriptorRegistry() {
|
||||
protected SqlTypeDescriptorRegistry() {
|
||||
addDescriptor( BooleanTypeDescriptor.INSTANCE );
|
||||
|
||||
addDescriptor( BitTypeDescriptor.INSTANCE );
|
||||
|
@ -67,10 +76,18 @@ public class SqlTypeDescriptorRegistry {
|
|||
addDescriptor( NClobTypeDescriptor.DEFAULT );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated (5.3) Use {@link org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry#addDescriptor(SqlTypeDescriptor)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public void addDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
|
||||
descriptorMap.put( sqlTypeDescriptor.getSqlType(), sqlTypeDescriptor );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated (5.3) Use {@link org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry#getDescriptor(int)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public SqlTypeDescriptor getDescriptor(int jdbcTypeCode) {
|
||||
SqlTypeDescriptor descriptor = descriptorMap.get( Integer.valueOf( jdbcTypeCode ) );
|
||||
if ( descriptor != null ) {
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.type.descriptor.sql.spi;
|
||||
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
/**
|
||||
* Basically a map from JDBC type code (int) -> {@link SqlTypeDescriptor}
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
* @author Andrea Boriero
|
||||
*
|
||||
* @since 5.3
|
||||
*/
|
||||
public class SqlTypeDescriptorRegistry extends org.hibernate.type.descriptor.sql.SqlTypeDescriptorRegistry {
|
||||
private TypeConfiguration typeConfiguration;
|
||||
|
||||
public SqlTypeDescriptorRegistry(TypeConfiguration typeConfiguration) {
|
||||
this.typeConfiguration = typeConfiguration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
|
||||
super.addDescriptor( sqlTypeDescriptor );
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor getDescriptor(int jdbcTypeCode) {
|
||||
return super.getDescriptor( jdbcTypeCode );
|
||||
}
|
||||
}
|
|
@ -27,6 +27,8 @@ import org.hibernate.type.BasicTypeRegistry;
|
|||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.TypeFactory;
|
||||
import org.hibernate.type.TypeResolver;
|
||||
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
|
||||
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry;
|
||||
|
||||
import static org.hibernate.internal.CoreLogging.messageLogger;
|
||||
|
||||
|
@ -46,7 +48,7 @@ import static org.hibernate.internal.CoreLogging.messageLogger;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*
|
||||
* @since 6.0
|
||||
* @since 5.3
|
||||
*/
|
||||
@Incubating
|
||||
public class TypeConfiguration implements SessionFactoryObserver, Serializable {
|
||||
|
@ -55,8 +57,10 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable {
|
|||
// todo : (
|
||||
private final Scope scope;
|
||||
private final TypeFactory typeFactory;
|
||||
private boolean initialized = false;
|
||||
|
||||
// things available during both boot and runtime ("active") lifecycle phases
|
||||
private final JavaTypeDescriptorRegistry javaTypeDescriptorRegistry;
|
||||
private final SqlTypeDescriptorRegistry sqlTypeDescriptorRegistry;
|
||||
private final BasicTypeRegistry basicTypeRegistry;
|
||||
|
||||
private final Map<String,String> importMap = new ConcurrentHashMap<>();
|
||||
|
@ -66,11 +70,12 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable {
|
|||
private final TypeResolver typeResolver;
|
||||
|
||||
public TypeConfiguration() {
|
||||
this.scope = new Scope( );
|
||||
this.scope = new Scope();
|
||||
this.javaTypeDescriptorRegistry = new JavaTypeDescriptorRegistry( this );
|
||||
this.sqlTypeDescriptorRegistry = new SqlTypeDescriptorRegistry( this );
|
||||
basicTypeRegistry = new BasicTypeRegistry();
|
||||
typeFactory = new TypeFactory( this );
|
||||
typeResolver = new TypeResolver( this, typeFactory );
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,6 +96,15 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable {
|
|||
return basicTypeRegistry;
|
||||
}
|
||||
|
||||
|
||||
public JavaTypeDescriptorRegistry getJavaTypeDescriptorRegistry() {
|
||||
return javaTypeDescriptorRegistry;
|
||||
}
|
||||
|
||||
public SqlTypeDescriptorRegistry getSqlTypeDescriptorRegistry() {
|
||||
return sqlTypeDescriptorRegistry;
|
||||
}
|
||||
|
||||
public Map<String, String> getImportMap() {
|
||||
return Collections.unmodifiableMap( importMap );
|
||||
}
|
||||
|
@ -133,8 +147,7 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable {
|
|||
|
||||
scope.setSessionFactory( sessionFactory );
|
||||
sessionFactory.addObserver( this );
|
||||
MetamodelImpl metamodel = new MetamodelImpl( sessionFactory, this );
|
||||
return metamodel;
|
||||
return new MetamodelImpl( sessionFactory, this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,32 +19,32 @@ import java.lang.annotation.Annotation;
|
|||
* @author Janario Oliveira
|
||||
*/
|
||||
public interface DynamicParameterizedType extends ParameterizedType {
|
||||
public static final String PARAMETER_TYPE = "org.hibernate.type.ParameterType";
|
||||
String PARAMETER_TYPE = "org.hibernate.type.ParameterType";
|
||||
|
||||
public static final String IS_DYNAMIC = "org.hibernate.type.ParameterType.dynamic";
|
||||
String IS_DYNAMIC = "org.hibernate.type.ParameterType.dynamic";
|
||||
|
||||
public static final String RETURNED_CLASS = "org.hibernate.type.ParameterType.returnedClass";
|
||||
public static final String IS_PRIMARY_KEY = "org.hibernate.type.ParameterType.primaryKey";
|
||||
public static final String ENTITY = "org.hibernate.type.ParameterType.entityClass";
|
||||
public static final String PROPERTY = "org.hibernate.type.ParameterType.propertyName";
|
||||
public static final String ACCESS_TYPE = "org.hibernate.type.ParameterType.accessType";
|
||||
public static final String XPROPERTY = "org.hibernate.type.ParameterType.xproperty";
|
||||
String RETURNED_CLASS = "org.hibernate.type.ParameterType.returnedClass";
|
||||
String IS_PRIMARY_KEY = "org.hibernate.type.ParameterType.primaryKey";
|
||||
String ENTITY = "org.hibernate.type.ParameterType.entityClass";
|
||||
String PROPERTY = "org.hibernate.type.ParameterType.propertyName";
|
||||
String ACCESS_TYPE = "org.hibernate.type.ParameterType.accessType";
|
||||
String XPROPERTY = "org.hibernate.type.ParameterType.xproperty";
|
||||
|
||||
public static interface ParameterType {
|
||||
interface ParameterType {
|
||||
|
||||
public Class getReturnedClass();
|
||||
Class getReturnedClass();
|
||||
|
||||
public Annotation[] getAnnotationsMethod();
|
||||
Annotation[] getAnnotationsMethod();
|
||||
|
||||
public String getCatalog();
|
||||
String getCatalog();
|
||||
|
||||
public String getSchema();
|
||||
String getSchema();
|
||||
|
||||
public String getTable();
|
||||
String getTable();
|
||||
|
||||
public boolean isPrimaryKey();
|
||||
boolean isPrimaryKey();
|
||||
|
||||
public String[] getColumns();
|
||||
String[] getColumns();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public interface EnhancedUserType extends UserType {
|
|||
/**
|
||||
* Return an SQL literal representation of the value
|
||||
*/
|
||||
public String objectToSQLString(Object value);
|
||||
String objectToSQLString(Object value);
|
||||
|
||||
/**
|
||||
* Return a string representation of this value, as it should appear in an XML document
|
||||
|
@ -24,7 +24,7 @@ public interface EnhancedUserType extends UserType {
|
|||
* instead. See <a href="https://hibernate.onjira.com/browse/HHH-7776">HHH-7776</a> for details
|
||||
*/
|
||||
@Deprecated
|
||||
public String toXMLString(Object value);
|
||||
String toXMLString(Object value);
|
||||
|
||||
/**
|
||||
* Parse a string representation of this value, as it appears in an XML document
|
||||
|
@ -34,5 +34,5 @@ public interface EnhancedUserType extends UserType {
|
|||
* See <a href="https://hibernate.onjira.com/browse/HHH-7776">HHH-7776</a> for details
|
||||
*/
|
||||
@Deprecated
|
||||
public Object fromXMLString(String xmlValue);
|
||||
Object fromXMLString(String xmlValue);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,9 @@ import java.sql.ResultSet;
|
|||
import java.sql.SQLException;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.boot.model.JavaTypeDescriptor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
/**
|
||||
* This interface should be implemented by user-defined "types".
|
||||
|
|
|
@ -16,10 +16,12 @@ import javax.persistence.Table;
|
|||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.annotations.Immutable;
|
||||
import org.hibernate.boot.MetadataBuilder;
|
||||
import org.hibernate.boot.MetadataSources;
|
||||
import org.hibernate.boot.registry.BootstrapServiceRegistryBuilder;
|
||||
import org.hibernate.boot.internal.MetadataBuilderImpl;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.metamodel.spi.MetamodelImplementor;
|
||||
import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry;
|
||||
import org.hibernate.type.descriptor.java.MutabilityPlan;
|
||||
|
@ -36,19 +38,15 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class ExplicitJavaTypeDescriptorTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||
@Override
|
||||
protected void configureBootstrapServiceRegistryBuilder(BootstrapServiceRegistryBuilder bsrb) {
|
||||
super.configureBootstrapServiceRegistryBuilder( bsrb );
|
||||
|
||||
// Let's tell Hibernate to treat MutableState2 as immutable
|
||||
JavaTypeDescriptorRegistry.INSTANCE.addDescriptor(
|
||||
new JavaTypeDescriptorRegistry.FallbackJavaTypeDescriptor( MutableState2.class ) {
|
||||
@Override
|
||||
public MutabilityPlan getMutabilityPlan() {
|
||||
return ImmutableMutabilityPlan.INSTANCE;
|
||||
}
|
||||
}
|
||||
);
|
||||
@Override
|
||||
protected void configureMetadataBuilder(MetadataBuilder metadataBuilder) {
|
||||
((MetadataBuilderImpl)metadataBuilder).contributeJavaTypeDescriptor(new JavaTypeDescriptorRegistry.FallbackJavaTypeDescriptor( MutableState2.class ) {
|
||||
@Override
|
||||
public MutabilityPlan getMutabilityPlan() {
|
||||
return ImmutableMutabilityPlan.INSTANCE;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,6 +69,16 @@ public class ExplicitJavaTypeDescriptorTest extends BaseNonConfigCoreFunctionalT
|
|||
public void testIt() {
|
||||
// set up test data
|
||||
Session session = openSession();
|
||||
( (MetamodelImplementor) session.getMetamodel() ).getTypeConfiguration()
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.addDescriptor(
|
||||
new JavaTypeDescriptorRegistry.FallbackJavaTypeDescriptor( MutableState2.class ) {
|
||||
@Override
|
||||
public MutabilityPlan getMutabilityPlan() {
|
||||
return ImmutableMutabilityPlan.INSTANCE;
|
||||
}
|
||||
}
|
||||
);
|
||||
session.beginTransaction();
|
||||
session.persist( new TheEntity(1) );
|
||||
session.getTransaction().commit();
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.Properties;
|
|||
|
||||
import org.hibernate.internal.util.SerializationHelper;
|
||||
import org.hibernate.type.EnumType;
|
||||
import org.hibernate.usertype.DynamicParameterizedType;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -25,9 +25,11 @@ import static org.junit.Assert.assertTrue;
|
|||
public class TestEnumTypeSerialization extends BaseUnitTestCase {
|
||||
@Test
|
||||
public void testSerializability() {
|
||||
TypeConfiguration typeConfiguration = new TypeConfiguration();
|
||||
{
|
||||
// test ordinal mapping
|
||||
EnumType enumType = new EnumType();
|
||||
EnumType enumType = new EnumType( );
|
||||
enumType.setTypeConfiguration( typeConfiguration );
|
||||
Properties properties = new Properties();
|
||||
properties.put( EnumType.ENUM, UnspecifiedEnumTypeEntity.E1.class.getName() );
|
||||
enumType.setParameterValues( properties );
|
||||
|
@ -38,6 +40,7 @@ public class TestEnumTypeSerialization extends BaseUnitTestCase {
|
|||
{
|
||||
// test named mapping
|
||||
EnumType enumType = new EnumType();
|
||||
enumType.setTypeConfiguration( typeConfiguration );
|
||||
Properties properties = new Properties();
|
||||
properties.put( EnumType.ENUM, UnspecifiedEnumTypeEntity.E1.class.getName() );
|
||||
properties.put( EnumType.NAMED, "true" );
|
||||
|
|
|
@ -39,6 +39,12 @@ public class LongListTypeContributorTest extends BaseEntityManagerFunctionalTest
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterEntityManagerFactoryBuilt() {
|
||||
entityManagerFactory().getMetamodel().getTypeConfiguration().getJavaTypeDescriptorRegistry()
|
||||
.addDescriptor( StringifiedCollectionTypeContributor.StringifiedCollectionJavaTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addConfigOptions(Map options) {
|
||||
super.addConfigOptions( options );
|
||||
|
@ -136,7 +142,7 @@ public class LongListTypeContributorTest extends BaseEntityManagerFunctionalTest
|
|||
|
||||
@Override
|
||||
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
||||
JavaTypeDescriptorRegistry.INSTANCE.addDescriptor( StringifiedCollectionJavaTypeDescriptor.INSTANCE );
|
||||
// JavaTypeDescriptorRegistry.INSTANCE.addDescriptor( StringifiedCollectionJavaTypeDescriptor.INSTANCE );
|
||||
typeContributions.contributeType( StringifiedCollectionType.INSTANCE );
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ public class GeolatteGeometryJavaTypeDescriptor extends AbstractTypeDescriptor<G
|
|||
*/
|
||||
public GeolatteGeometryJavaTypeDescriptor() {
|
||||
super( Geometry.class );
|
||||
JavaTypeDescriptorRegistry.INSTANCE.addDescriptor( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,7 +35,6 @@ public class JTSGeometryJavaTypeDescriptor extends AbstractTypeDescriptor<Geomet
|
|||
*/
|
||||
public JTSGeometryJavaTypeDescriptor() {
|
||||
super( Geometry.class );
|
||||
JavaTypeDescriptorRegistry.INSTANCE.addDescriptor( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,7 +28,7 @@ public interface SpatialDialect extends Serializable {
|
|||
*
|
||||
* @return SQL fragment {@code SpatialRelateExpression}
|
||||
*/
|
||||
public String getSpatialRelateSQL(String columnName, int spatialRelation);
|
||||
String getSpatialRelateSQL(String columnName, int spatialRelation);
|
||||
|
||||
/**
|
||||
* Returns the SQL fragment for the SQL WHERE-expression when parsing
|
||||
|
@ -40,7 +40,7 @@ public interface SpatialDialect extends Serializable {
|
|||
*
|
||||
* @return Rhe SQL fragment for the {@code SpatialFilterExpression}
|
||||
*/
|
||||
public String getSpatialFilterExpression(String columnName);
|
||||
String getSpatialFilterExpression(String columnName);
|
||||
|
||||
/**
|
||||
* Returns the SQL fragment for the specfied Spatial aggregate expression.
|
||||
|
@ -50,7 +50,7 @@ public interface SpatialDialect extends Serializable {
|
|||
*
|
||||
* @return The SQL fragment for the projection
|
||||
*/
|
||||
public String getSpatialAggregateSQL(String columnName, int aggregation);
|
||||
String getSpatialAggregateSQL(String columnName, int aggregation);
|
||||
|
||||
/**
|
||||
* Returns The SQL fragment when parsing a <code>DWithinExpression</code>.
|
||||
|
@ -59,7 +59,7 @@ public interface SpatialDialect extends Serializable {
|
|||
*
|
||||
* @return The SQL fragment when parsing a <code>DWithinExpression</code>.
|
||||
*/
|
||||
public String getDWithinSQL(String columnName);
|
||||
String getDWithinSQL(String columnName);
|
||||
|
||||
/**
|
||||
* Returns the SQL fragment when parsing a <code>HavingSridExpression</code>.
|
||||
|
@ -68,7 +68,7 @@ public interface SpatialDialect extends Serializable {
|
|||
*
|
||||
* @return The SQL fragment for a <code>HavingSridExpression</code>.
|
||||
*/
|
||||
public String getHavingSridSQL(String columnName);
|
||||
String getHavingSridSQL(String columnName);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -80,7 +80,7 @@ public interface SpatialDialect extends Serializable {
|
|||
*
|
||||
* @return The SQL fragment for the isempty function
|
||||
*/
|
||||
public String getIsEmptySQL(String columnName, boolean isEmpty);
|
||||
String getIsEmptySQL(String columnName, boolean isEmpty);
|
||||
|
||||
/**
|
||||
* Returns true if this <code>SpatialDialect</code> supports a specific filtering function.
|
||||
|
@ -88,7 +88,7 @@ public interface SpatialDialect extends Serializable {
|
|||
*
|
||||
* @return True if filtering is supported
|
||||
*/
|
||||
public boolean supportsFiltering();
|
||||
boolean supportsFiltering();
|
||||
|
||||
/**
|
||||
* Does this dialect supports the specified <code>SpatialFunction</code>.
|
||||
|
@ -97,6 +97,6 @@ public interface SpatialDialect extends Serializable {
|
|||
*
|
||||
* @return True if this <code>SpatialDialect</code> supports the spatial function specified by the function parameter.
|
||||
*/
|
||||
public boolean supports(SpatialFunction function);
|
||||
boolean supports(SpatialFunction function);
|
||||
|
||||
}
|
||||
|
|
|
@ -15,8 +15,10 @@ import org.hibernate.dialect.DB2Dialect;
|
|||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
import org.hibernate.engine.config.spi.ConfigurationService;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.GeolatteGeometryJavaTypeDescriptor;
|
||||
import org.hibernate.spatial.GeolatteGeometryType;
|
||||
import org.hibernate.spatial.HibernateSpatialConfigurationSettings;
|
||||
import org.hibernate.spatial.JTSGeometryJavaTypeDescriptor;
|
||||
import org.hibernate.spatial.JTSGeometryType;
|
||||
import org.hibernate.spatial.SpatialAggregate;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
|
@ -52,6 +54,9 @@ public class DB2SpatialDialect extends DB2Dialect implements SpatialDialect {
|
|||
final DB2GeometryTypeDescriptor typeDescriptor = mkDescriptor( serviceRegistry );
|
||||
typeContributions.contributeType( new GeolatteGeometryType( typeDescriptor ) );
|
||||
typeContributions.contributeType( new JTSGeometryType( typeDescriptor ) );
|
||||
|
||||
typeContributions.contributeJavaTypeDescriptor( GeolatteGeometryJavaTypeDescriptor.INSTANCE );
|
||||
typeContributions.contributeJavaTypeDescriptor( JTSGeometryJavaTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
private DB2GeometryTypeDescriptor mkDescriptor(ServiceRegistry serviceRegistry) {
|
||||
|
|
|
@ -11,7 +11,9 @@ import org.hibernate.boot.model.TypeContributions;
|
|||
import org.hibernate.dialect.H2Dialect;
|
||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.GeolatteGeometryJavaTypeDescriptor;
|
||||
import org.hibernate.spatial.GeolatteGeometryType;
|
||||
import org.hibernate.spatial.JTSGeometryJavaTypeDescriptor;
|
||||
import org.hibernate.spatial.JTSGeometryType;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
import org.hibernate.spatial.SpatialFunction;
|
||||
|
@ -79,6 +81,9 @@ public class GeoDBDialect extends H2Dialect implements SpatialDialect {
|
|||
super.contributeTypes( typeContributions, serviceRegistry );
|
||||
typeContributions.contributeType( new GeolatteGeometryType( GeoDBGeometryTypeDescriptor.INSTANCE ) );
|
||||
typeContributions.contributeType( new JTSGeometryType( GeoDBGeometryTypeDescriptor.INSTANCE ) );
|
||||
|
||||
typeContributions.contributeJavaTypeDescriptor( GeolatteGeometryJavaTypeDescriptor.INSTANCE );
|
||||
typeContributions.contributeJavaTypeDescriptor( JTSGeometryJavaTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,7 +13,9 @@ import org.hibernate.dialect.HANAColumnStoreDialect;
|
|||
import org.hibernate.engine.config.spi.ConfigurationService;
|
||||
import org.hibernate.engine.config.spi.ConfigurationService.Converter;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.GeolatteGeometryJavaTypeDescriptor;
|
||||
import org.hibernate.spatial.GeolatteGeometryType;
|
||||
import org.hibernate.spatial.JTSGeometryJavaTypeDescriptor;
|
||||
import org.hibernate.spatial.JTSGeometryType;
|
||||
import org.hibernate.spatial.SpatialAggregate;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
|
@ -305,6 +307,8 @@ public class HANASpatialDialect extends HANAColumnStoreDialect implements Spatia
|
|||
typeContributions.contributeType( new JTSGeometryType( HANAGeometryTypeDescriptor.INSTANCE ) );
|
||||
}
|
||||
|
||||
typeContributions.contributeJavaTypeDescriptor( GeolatteGeometryJavaTypeDescriptor.INSTANCE );
|
||||
typeContributions.contributeJavaTypeDescriptor( JTSGeometryJavaTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,7 +12,9 @@ import org.hibernate.boot.model.TypeContributions;
|
|||
import org.hibernate.dialect.MySQLDialect;
|
||||
import org.hibernate.dialect.function.SQLFunction;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.GeolatteGeometryJavaTypeDescriptor;
|
||||
import org.hibernate.spatial.GeolatteGeometryType;
|
||||
import org.hibernate.spatial.JTSGeometryJavaTypeDescriptor;
|
||||
import org.hibernate.spatial.JTSGeometryType;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
import org.hibernate.spatial.SpatialFunction;
|
||||
|
@ -47,6 +49,9 @@ public class MySQLSpatialDialect extends MySQLDialect implements SpatialDialect
|
|||
);
|
||||
typeContributions.contributeType( new GeolatteGeometryType( MySQLGeometryTypeDescriptor.INSTANCE ) );
|
||||
typeContributions.contributeType( new JTSGeometryType( MySQLGeometryTypeDescriptor.INSTANCE ) );
|
||||
|
||||
typeContributions.contributeJavaTypeDescriptor( GeolatteGeometryJavaTypeDescriptor.INSTANCE );
|
||||
typeContributions.contributeJavaTypeDescriptor( JTSGeometryJavaTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,9 +12,11 @@ import org.hibernate.boot.model.TypeContributions;
|
|||
import org.hibernate.boot.registry.selector.spi.StrategySelector;
|
||||
import org.hibernate.engine.config.spi.ConfigurationService;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.GeolatteGeometryJavaTypeDescriptor;
|
||||
import org.hibernate.spatial.GeolatteGeometryType;
|
||||
import org.hibernate.spatial.HSMessageLogger;
|
||||
import org.hibernate.spatial.HibernateSpatialConfigurationSettings;
|
||||
import org.hibernate.spatial.JTSGeometryJavaTypeDescriptor;
|
||||
import org.hibernate.spatial.JTSGeometryType;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
import org.hibernate.spatial.SpatialFunction;
|
||||
|
@ -54,6 +56,9 @@ class OracleSDOSupport implements SpatialDialect, Serializable {
|
|||
final SDOGeometryTypeDescriptor sdoGeometryTypeDescriptor = mkSdoGeometryTypeDescriptor( serviceRegistry );
|
||||
typeContributions.contributeType( new GeolatteGeometryType( sdoGeometryTypeDescriptor ) );
|
||||
typeContributions.contributeType( new JTSGeometryType( sdoGeometryTypeDescriptor ) );
|
||||
|
||||
typeContributions.contributeJavaTypeDescriptor( GeolatteGeometryJavaTypeDescriptor.INSTANCE );
|
||||
typeContributions.contributeJavaTypeDescriptor( JTSGeometryJavaTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
private SDOGeometryTypeDescriptor mkSdoGeometryTypeDescriptor(ServiceRegistry serviceRegistry) {
|
||||
|
|
|
@ -10,7 +10,9 @@ import java.io.Serializable;
|
|||
|
||||
import org.hibernate.boot.model.TypeContributions;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.GeolatteGeometryJavaTypeDescriptor;
|
||||
import org.hibernate.spatial.GeolatteGeometryType;
|
||||
import org.hibernate.spatial.JTSGeometryJavaTypeDescriptor;
|
||||
import org.hibernate.spatial.JTSGeometryType;
|
||||
import org.hibernate.spatial.SpatialAggregate;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
|
@ -28,6 +30,9 @@ public class PostgisSupport implements SpatialDialect, Serializable {
|
|||
void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
||||
typeContributions.contributeType( new GeolatteGeometryType( PGGeometryTypeDescriptor.INSTANCE ) );
|
||||
typeContributions.contributeType( new JTSGeometryType( PGGeometryTypeDescriptor.INSTANCE ) );
|
||||
|
||||
typeContributions.contributeJavaTypeDescriptor( GeolatteGeometryJavaTypeDescriptor.INSTANCE );
|
||||
typeContributions.contributeJavaTypeDescriptor( JTSGeometryJavaTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
public PostgisFunctions functionsToRegister() {
|
||||
|
|
|
@ -12,7 +12,9 @@ import org.hibernate.boot.model.TypeContributions;
|
|||
import org.hibernate.dialect.SQLServer2008Dialect;
|
||||
import org.hibernate.dialect.function.SQLFunctionTemplate;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.spatial.GeolatteGeometryJavaTypeDescriptor;
|
||||
import org.hibernate.spatial.GeolatteGeometryType;
|
||||
import org.hibernate.spatial.JTSGeometryJavaTypeDescriptor;
|
||||
import org.hibernate.spatial.JTSGeometryType;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
import org.hibernate.spatial.SpatialFunction;
|
||||
|
@ -104,6 +106,9 @@ public class SqlServer2008SpatialDialect extends SQLServer2008Dialect implements
|
|||
);
|
||||
typeContributions.contributeType( new GeolatteGeometryType( SqlServer2008GeometryTypeDescriptor.INSTANCE ) );
|
||||
typeContributions.contributeType( new JTSGeometryType( SqlServer2008GeometryTypeDescriptor.INSTANCE ) );
|
||||
|
||||
typeContributions.contributeJavaTypeDescriptor( GeolatteGeometryJavaTypeDescriptor.INSTANCE );
|
||||
typeContributions.contributeJavaTypeDescriptor( JTSGeometryJavaTypeDescriptor.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -145,7 +145,6 @@ public class BaseNonConfigCoreFunctionalTestCase extends BaseUnitTestCase {
|
|||
final MetadataBuilder metadataBuilder = metadataSources.getMetadataBuilder();
|
||||
initialize( metadataBuilder );
|
||||
configureMetadataBuilder( metadataBuilder );
|
||||
|
||||
metadata = (MetadataImplementor) metadataBuilder.build();
|
||||
applyCacheSettings( metadata );
|
||||
afterMetadataBuilt( metadata );
|
||||
|
|
Loading…
Reference in New Issue