Package org.hibernate.type.spi
Class TypeConfiguration
- java.lang.Object
-
- org.hibernate.type.spi.TypeConfiguration
-
- All Implemented Interfaces:
Serializable
,SessionFactoryObserver
public class TypeConfiguration extends Object implements SessionFactoryObserver, Serializable
Defines a set of available Type instances as isolated from other configurations. The isolation is defined by each instance of a TypeConfiguration. Note that each Type is inherently "scoped" to a TypeConfiguration. We only ever access a Type through a TypeConfiguration - specifically the TypeConfiguration in effect for the current persistence unit. Even though each Type instance is scoped to a TypeConfiguration, Types do not inherently have access to that TypeConfiguration (mainly because Type is an extension contract - meaning that Hibernate does not manage the full set of Types available in ever TypeConfiguration). However Types will often want access to the TypeConfiguration, which can be achieved by the Type simply implementing theTypeConfigurationAware
interface.- Since:
- 5.3
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TypeConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addBasicTypeRegistrationContributions(List<BasicTypeRegistration> contributions)
BasicTypeRegistry
getBasicTypeRegistry()
Map<String,String>
getImportMap()
JavaTypeDescriptorRegistry
getJavaTypeDescriptorRegistry()
Map<Integer,Set<String>>
getJdbcToHibernateTypeContributionMap()
MetadataBuildingContext
getMetadataBuildingContext()
Obtain the MetadataBuildingContext currently scoping the TypeConfiguration.ServiceRegistry
getServiceRegistry()
Obtain the ServiceRegistry scoped to the TypeConfiguration.SessionFactoryImplementor
getSessionFactory()
Obtain the SessionFactory currently scoping the TypeConfiguration.SqlTypeDescriptorRegistry
getSqlTypeDescriptorRegistry()
TypeResolver
getTypeResolver()
Deprecated.(since 5.3) No replacement, access to and handling of Types will be much different in 6.0String
getUuid()
void
scope(MetadataBuildingContext metadataBuildingContext)
MetamodelImplementor
scope(SessionFactoryImplementor sessionFactory)
void
sessionFactoryClosed(SessionFactory factory)
Callback to indicate that the given factory has been closed.void
sessionFactoryCreated(SessionFactory factory)
Callback to indicate that the given factory has been created and is now ready for use.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.SessionFactoryObserver
sessionFactoryClosing
-
-
-
-
Method Detail
-
getUuid
public String getUuid()
-
getTypeResolver
@Deprecated public TypeResolver getTypeResolver()
Deprecated.(since 5.3) No replacement, access to and handling of Types will be much different in 6.0Temporarily needed to support deprecations Retrieve theType
resolver associated with this factory.- Returns:
- The type resolver
-
getBasicTypeRegistry
public BasicTypeRegistry getBasicTypeRegistry()
-
getJavaTypeDescriptorRegistry
public JavaTypeDescriptorRegistry getJavaTypeDescriptorRegistry()
-
getSqlTypeDescriptorRegistry
public SqlTypeDescriptorRegistry getSqlTypeDescriptorRegistry()
-
getJdbcToHibernateTypeContributionMap
public Map<Integer,Set<String>> getJdbcToHibernateTypeContributionMap()
-
getMetadataBuildingContext
public MetadataBuildingContext getMetadataBuildingContext()
Obtain the MetadataBuildingContext currently scoping the TypeConfiguration.- Returns:
- The MetadataBuildingContext
- ApiNote:
- This will throw an exception if the SessionFactory is not yet
bound here. See
TypeConfiguration.Scope
for more details regarding the stages a TypeConfiguration goes through
-
scope
public void scope(MetadataBuildingContext metadataBuildingContext)
-
scope
public MetamodelImplementor scope(SessionFactoryImplementor sessionFactory)
-
getSessionFactory
public SessionFactoryImplementor getSessionFactory()
Obtain the SessionFactory currently scoping the TypeConfiguration.- Returns:
- The SessionFactory
- Throws:
IllegalStateException
- if the TypeConfiguration is currently not associated with a SessionFactory (in "runtime stage").- ApiNote:
- This will throw an exception if the SessionFactory is not yet
bound here. See
TypeConfiguration.Scope
for more details regarding the stages a TypeConfiguration goes through (this is "runtime stage")
-
getServiceRegistry
public ServiceRegistry getServiceRegistry()
Obtain the ServiceRegistry scoped to the TypeConfiguration.- Returns:
- The ServiceRegistry
- ApiNote:
- Depending on what the
TypeConfiguration.Scope
is currently scoped to will determine where theServiceRegistry
is obtained from.
-
sessionFactoryCreated
public void sessionFactoryCreated(SessionFactory factory)
Description copied from interface:SessionFactoryObserver
Callback to indicate that the given factory has been created and is now ready for use.- Specified by:
sessionFactoryCreated
in interfaceSessionFactoryObserver
- Parameters:
factory
- The factory initialized.
-
sessionFactoryClosed
public void sessionFactoryClosed(SessionFactory factory)
Description copied from interface:SessionFactoryObserver
Callback 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:
sessionFactoryClosed
in interfaceSessionFactoryObserver
- Parameters:
factory
- The factory closed.
-
addBasicTypeRegistrationContributions
public void addBasicTypeRegistrationContributions(List<BasicTypeRegistration> contributions)
-
-