Package org.hibernate.type.spi
Class TypeConfiguration
java.lang.Object
org.hibernate.type.spi.TypeConfiguration
- All Implemented Interfaces:
Serializable,SessionFactoryObserver
Each instance defines a set oftypes available in a given persistence unit, and isolates them from other configurations.
Note that each instance ofType is inherently "scoped" to aTypeConfiguration. We always obtain a reference to aType via theTypeConfiguration associated with the current persistence unit.
On the other hand, aType does not inherently have access to its parentTypeConfiguration since extensions may contribute instances ofType, viaTypeContributions, for example, and the instantiation of such instances occurs outside the control of Hibernate.
In particular, a customTypeContributor may contribute types to aTypeConfiguration.
If aType requires access to the parentTypeConfiguration, it should implementTypeConfigurationAware.
- Since:
- 5.3
- See Also:
Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionvoidaddBasicTypeRegistrationContributions(List<BasicTypeRegistration> contributions) <J> MutabilityPlan<J>createMutabilityPlan(Class<? extendsMutabilityPlan<?>> planClass) Class<?>entityClassForEntityName(String entityName) Workaround for an issue faced inEntityType.getReturnedClass().<J> BasicType<J>getBasicTypeForGenericJavaType(Class<? super J> javaType,Type... typeArguments) <J> BasicType<J>getBasicTypeForJavaType(Class<J> javaType) <J> BasicType<J>getBasicTypeForJavaType(Type javaType) Deprecated, for removal: This API element is subject to removal in a future version.No longer usedfinalFormatMapperDeprecated.This operation is not very typesafe, and we're migrating away from its useDeprecated.This simply isn't a very sensible place to hang theServiceRegistryDeprecated.This operation is not very typesafe, and we're migrating away from its useprotected staticIntervalTypegetSqlIntervalType(int jdbcTypeCode) staticIntervalTypegetSqlIntervalType(JdbcMappingContainer jdbcMappings) staticIntervalTypegetSqlIntervalType(JdbcType descriptor) protected staticTemporalTypegetSqlTemporalType(int jdbcTypeCode) staticTemporalTypegetSqlTemporalType(JdbcMapping jdbcMapping) staticTemporalTypegetSqlTemporalType(JdbcMappingContainer jdbcMappings) staticTemporalTypegetSqlTemporalType(SqmExpressible<?> type) staticTemporalTypegetSqlTemporalType(JdbcType descriptor) getUuid()finalFormatMapperstatic booleanisDuration(SqmExpressible<?> type) static booleanisJdbcTemporalType(SqmExpressible<?> type) resolveArithmeticType(SqmExpressible<?> firstType,SqmExpressible<?> secondType) Determine the result type of an arithmetic operation as defined by the rules in section 6.5.8.1.resolveArithmeticType(SqmExpressible<?> firstType,SqmExpressible<?> secondType,BinaryArithmeticOperator operator) BasicType<?>resolveCastTargetType(String name) Understands the following target type names for thecast()function:StringCharacterByte,Short,Integer,LongFloat,DoubleTime,Date,TimestampLocalDate,LocalTime,LocalDateTimeBigIntegerBigDecimalBinaryBoolean(fragile, not aware of encoding to character viaCharBooleanConverter)resolveTupleType(List<? extendsSqmTypedNode<?>> typedNodes) voidscope(MetadataBuildingContext metadataBuildingContext) Scope thisTypeConfigurationto the givenMetadataBuildingContext.voidscope(SessionFactoryImplementor sessionFactory) Scope thisTypeConfigurationto the givenSessionFactory.voidsessionFactoryClosed(SessionFactory factory) Callback to indicate that the given factory has been closed.voidsessionFactoryCreated(SessionFactory factory) Callback to indicate that the given factory has been created and is now ready for use.<J> BasicType<J>standardBasicTypeForJavaType(Class<J> javaType) <J> BasicType<J>standardBasicTypeForJavaType(Class<J> javaType,Function<JavaType<J>, BasicType<J>> creator) BasicType<?>standardBasicTypeForJavaType(Type javaType) <J> BasicType<J>standardBasicTypeForJavaType(Type javaType,Function<JavaType<J>, BasicType<J>> creator) Methods inherited from class java.lang.Object
clone,equals,finalize,getClass,hashCode,notify,notifyAll,toString,wait,wait,waitMethods inherited from interface org.hibernate.SessionFactoryObserver
sessionFactoryClosing
Constructor Details
TypeConfiguration
public TypeConfiguration()
Method Details
getUuid
getBasicTypeRegistry
getJavaTypeRegistry
getJdbcTypeRegistry
getDdlTypeRegistry
getCurrentBaseSqlTypeIndicators
getJdbcToHibernateTypeContributionMap
getMetadataBuildingContext
Deprecated.This operation is not very typesafe, and we're migrating away from its useObtain theMetadataBuildingContextcurrently scoping thisTypeConfiguration.- Returns:
- The
MetadataBuildingContext - API Note:
- Throws an exception if the
TypeConfigurationis no longer scoped to theMetadataBuildingContext. SeeTypeConfiguration.Scopefor more details regarding the stages aTypeConfigurationpasses through.
scope
Scope thisTypeConfigurationto the givenMetadataBuildingContext.- Parameters:
metadataBuildingContext- aMetadataBuildingContext- Implementation Note:
- The given factory is not yet fully-initialized!
scope
Scope thisTypeConfigurationto the givenSessionFactory.- Parameters:
sessionFactory- aSessionFactorythat is in a very fragile state- Implementation Note:
- The given factory is not yet fully-initialized!
getSessionFactory
Deprecated.This operation is not very typesafe, and we're migrating away from its useObtain theSessionFactorycurrently scoping thisTypeConfiguration.- Returns:
- The
SessionFactoryto which thisTypeConfigurationis scoped - Throws:
HibernateException- if theTypeConfigurationis not currently scoped to aSessionFactory(in a "runtime stage").- API Note:
- Throws an exception if the
TypeConfigurationis not yet scoped to a factory. SeeTypeConfiguration.Scopefor more details regarding the stages aTypeConfigurationpasses through (this is a "runtime stage").
getServiceRegistry
Deprecated.This simply isn't a very sensible place to hang theServiceRegistryObtain theServiceRegistryscoped to thisTypeConfiguration.- Returns:
- The
ServiceRegistryfor the current scope - API Note:
- The current
TypeConfiguration.Scopewill determine from where theServiceRegistryis obtained.
getJpaCompliance
Deprecated, for removal: This API element is subject to removal in a future version.No longer usedObtain theJpaCompliancesetting.entityClassForEntityName
Workaround for an issue faced inEntityType.getReturnedClass().sessionFactoryCreated
Description copied from interface:SessionFactoryObserverCallback to indicate that the given factory has been created and is now ready for use.- Specified by:
sessionFactoryCreatedin interfaceSessionFactoryObserver- Parameters:
factory- The factory initialized.
sessionFactoryClosed
Description copied from interface:SessionFactoryObserverCallback to indicate that the given factory has been closed. Care should be taken in how (if at all) the passed factory reference is used since it is closed.- Specified by:
sessionFactoryClosedin interfaceSessionFactoryObserver- Parameters:
factory- The factory closed.
addBasicTypeRegistrationContributions
resolveCastTargetType
Understands the following target type names for thecast()function:StringCharacterByte,Short,Integer,LongFloat,DoubleTime,Date,TimestampLocalDate,LocalTime,LocalDateTimeBigIntegerBigDecimalBinaryBoolean(fragile, not aware of encoding to character viaCharBooleanConverter)
The type names are not case-sensitive.
resolveTupleType
resolveArithmeticType
public SqmExpressible<?> resolveArithmeticType(SqmExpressible<?> firstType,SqmExpressible<?> secondType,BinaryArithmeticOperator operator) resolveArithmeticType
public SqmExpressible<?> resolveArithmeticType(SqmExpressible<?> firstType,SqmExpressible<?> secondType) Determine the result type of an arithmetic operation as defined by the rules in section 6.5.8.1.getBasicTypeForGenericJavaType
getBasicTypeForJavaType
getBasicTypeForJavaType
standardBasicTypeForJavaType
standardBasicTypeForJavaType
standardBasicTypeForJavaType
standardBasicTypeForJavaType
getSqlTemporalType
getSqlTemporalType
getSqlTemporalType
getSqlTemporalType
getSqlTemporalType
getSqlTemporalType
getSqlIntervalType
getSqlIntervalType
getSqlIntervalType
isJdbcTemporalType
isDuration
createMutabilityPlan
@Internalpublic <J> MutabilityPlan<J> createMutabilityPlan(Class<? extendsMutabilityPlan<?>> planClass) getJsonFormatMapper
getXmlFormatMapper