Package org.hibernate.boot.spi
Interface BootstrapContext
- All Known Implementing Classes:
BootstrapContextImpl,BootstrapContextImpl,MockSessionFactory,ProcessorSessionFactory
@Incubatingpublic interfaceBootstrapContext
Defines a context for things available during the process of bootstrapping aSessionFactorywhich are expected to be cleaned up after theSessionFactoryis built.
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ArchiveDescriptorFactorygetArchiveDescriptorFactory()Access to theArchiveDescriptorFactoryused for scanning.Collection<ConverterDescriptor>getAttributeConverters()Access to collectedAttributeConverterdefinitions.Collection<AuxiliaryDatabaseObject>getAuxiliaryDatabaseObjectList()Access to anyAuxiliaryDatabaseObjects explicitly registered with theMetadataBuilder.Collection<CacheRegionDefinition>getCacheRegionDefinitions()Access to all explicit cache region mappings.ClassLoaderAccessgetClassLoaderAccess()Access to class loading capabilities.ClassmateContextgetClassmateContext()Access to the sharedClassmateContextobject used throughout the bootstrap process.BeanInstanceProducergetCustomTypeProducer()TheBeanInstanceProducerto use when creating custom type references.SqmFunctionRegistrygetFunctionRegistry()TheSqmFunctionRegistrybelonging to thisBootstrapContext.defaultIdentifierGeneratorFactorygetIdentifierGeneratorFactory()org.jboss.jandex.IndexViewgetJandexView()Access to the Jandex index passed by call toMetadataBuilder.applyIndexView(IndexView), if any.MutableJpaCompliancegetJpaCompliance()In-flight form ofJpaComplianceClassLoadergetJpaTempClassLoader()Access the temporaryClassLoaderpassed to us, as defined byPersistenceUnitInfo.getNewTempClassLoader(), if any.MetadataBuildingOptionsgetMetadataBuildingOptions()Options specific to building theboot metamodelorg.hibernate.annotations.common.reflection.ReflectionManagergetReflectionManager()Retrieve the Hibernate Commons AnnotationsReflectionManager.ManagedTypeRepresentationResolvergetRepresentationStrategySelector()ScanEnvironmentgetScanEnvironment()Access to the environment for scanning.ObjectgetScanner()Access to theScannerto be used for scanning.ScanOptionsgetScanOptions()Access to the options to be used for scanning.StandardServiceRegistrygetServiceRegistry()The service registry available to bootstrappingMap<String,SqmFunctionDescriptor>getSqlFunctions()Access to any SQL functions explicitly registered with theMetadataBuilder.TypeConfigurationgetTypeConfiguration()TheTypeConfigurationbelonging to thisBootstrapContext.booleanisJpaBootstrap()Whether the bootstrap was initiated from JPA bootstrapping.voidmarkAsJpaBootstrap()Indicates that bootstrap was initiated from JPA bootstrapping.voidregisterAdHocBasicType(BasicType<?> basicType)To support Envers.voidrelease()Releases the "bootstrap only" resources held by thisBootstrapContext.<T> BasicType<T>resolveAdHocBasicType(String key)To support Envers.
Method Detail
getServiceRegistry
StandardServiceRegistry getServiceRegistry()
The service registry available to bootstrapping
getJpaCompliance
MutableJpaCompliance getJpaCompliance()
In-flight form ofJpaCompliance
getTypeConfiguration
TypeConfiguration getTypeConfiguration()
TheTypeConfigurationbelonging to thisBootstrapContext.- See Also:
TypeConfiguration
getFunctionRegistry
SqmFunctionRegistry getFunctionRegistry()
TheSqmFunctionRegistrybelonging to thisBootstrapContext.- See Also:
SqmFunctionRegistry
getCustomTypeProducer
BeanInstanceProducer getCustomTypeProducer()
TheBeanInstanceProducerto use when creating custom type references.- Implementation Note:
- Usually a
TypeBeanInstanceProducer.
getMetadataBuildingOptions
MetadataBuildingOptions getMetadataBuildingOptions()
Options specific to building theboot metamodel
getIdentifierGeneratorFactory
default IdentifierGeneratorFactory getIdentifierGeneratorFactory()
isJpaBootstrap
boolean isJpaBootstrap()
Whether the bootstrap was initiated from JPA bootstrapping.- See Also:
markAsJpaBootstrap()- Implementation Specification:
- This is used
markAsJpaBootstrap
void markAsJpaBootstrap()
Indicates that bootstrap was initiated from JPA bootstrapping.- Implementation Specification:
- Internally,
falseis the assumed value. We only need to call this to mark ittrue.
getJpaTempClassLoader
ClassLoader getJpaTempClassLoader()
Access the temporaryClassLoaderpassed to us, as defined byPersistenceUnitInfo.getNewTempClassLoader(), if any.- Returns:
- The temporary
ClassLoader
getClassLoaderAccess
ClassLoaderAccess getClassLoaderAccess()
Access to class loading capabilities.
getClassmateContext
ClassmateContext getClassmateContext()
Access to the sharedClassmateContextobject used throughout the bootstrap process.- Returns:
- Access to the shared
ClassmateContextdelegates.
getArchiveDescriptorFactory
ArchiveDescriptorFactory getArchiveDescriptorFactory()
Access to theArchiveDescriptorFactoryused for scanning.- Returns:
- The
ArchiveDescriptorFactory
getScanOptions
ScanOptions getScanOptions()
Access to the options to be used for scanning.- Returns:
- The scan options
getScanEnvironment
ScanEnvironment getScanEnvironment()
Access to the environment for scanning.- Returns:
- The scan environment
- API Note:
- Consider this temporary; see discussion on
ScanEnvironment.
getScanner
Object getScanner()
Access to theScannerto be used for scanning.Can be:
- An instance of
Scanner, - a
Classreference to theScannerimplementor, or - a string naming the
Scannerimplementor.
- Returns:
- The scanner
- An instance of
getReflectionManager
@Internalorg.hibernate.annotations.common.reflection.ReflectionManager getReflectionManager()
Retrieve the Hibernate Commons AnnotationsReflectionManager.- API Note:
- Supported for internal use only. This method will go away as we migrate away from Hibernate Commons Annotations to Jandex for annotation handling and XMl to annotation merging.
getJandexView
org.jboss.jandex.IndexView getJandexView()
Access to the Jandex index passed by call toMetadataBuilder.applyIndexView(IndexView), if any.- Returns:
- The Jandex index
- API Note:
- Jandex is currently not used, seethe roadmap
getSqlFunctions
Map<String,SqmFunctionDescriptor> getSqlFunctions()
Access to any SQL functions explicitly registered with theMetadataBuilder. This does not includeDialect-registered functions.Should never return
null.- Returns:
- The
SqmFunctionDescriptors registered viaMetadataBuilder
getAuxiliaryDatabaseObjectList
Collection<AuxiliaryDatabaseObject> getAuxiliaryDatabaseObjectList()
Access to anyAuxiliaryDatabaseObjects explicitly registered with theMetadataBuilder. This does not includeAuxiliaryDatabaseObjects defined in mappings.Should never return
null.- Returns:
- The
AuxiliaryDatabaseObjects registered viaMetadataBuilder
getAttributeConverters
Collection<ConverterDescriptor> getAttributeConverters()
Access to collectedAttributeConverterdefinitions.Should never return
null.- Returns:
- The
ConverterDescriptors registered viaMetadataBuilder
getCacheRegionDefinitions
Collection<CacheRegionDefinition> getCacheRegionDefinitions()
Access to all explicit cache region mappings.Should never return
null.- Returns:
- Explicit cache region mappings
getRepresentationStrategySelector
ManagedTypeRepresentationResolver getRepresentationStrategySelector()
- See Also:
ManagedTypeRepresentationResolver
release
void release()
Releases the "bootstrap only" resources held by thisBootstrapContext.
registerAdHocBasicType
void registerAdHocBasicType(BasicType<?> basicType)
To support Envers.