Package org.hibernate.engine.spi
Interface SessionFactoryImplementor
- All Superinterfaces:
AutoCloseable
,EntityManagerFactory
,Referenceable
,Serializable
,SessionFactory
- All Known Implementing Classes:
SessionFactoryDelegatingImpl
,SessionFactoryImpl
Defines the internal contract between the
SessionFactory
and the internal
implementation of Hibernate.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addObserver
(SessionFactoryObserver observer) Register aSessionFactoryObserver
of this factory.bestGuessEntityName
(Object object) The best guess entity name for an entity not in an associationfindEntityGraphByName
(String name) Return the rootEntityGraph
with the given name, ornull
if there is no graph with the given name.Obtain a collection ofFilterDefinition
s representing all the auto-enabled filters.getCache()
Obtain theCacheImplementor
.Obtain theClassLoaderService
.Obtain theCurrentTenantIdentifierResolver
Obtain theCustomEntityDirtinessStrategy
Obtain theEntityCopyObserverFactory
service.Obtain theEntityNotFoundDelegate
Get the EventEngine associated with this SessionFactoryAccess to the event listener groups.Obtain theEventListenerRegistry
service.getFetchProfile
(String name) Deprecated, for removal: This API element is subject to removal in a future version.getFilterDefinition
(String filterName) Obtain the definition of a filter by name.getGenerator
(String rootEntityName) Deprecated, for removal: This API element is subject to removal in a future version.Only used in one place, will be removedObtain theJdbcServices
service.Obtain theJdbcServices
service.default JpaMetamodel
Obtain theJpaMetamodel
Obtain theManagedBeanRegistry
service.default MappingMetamodelImplementor
Obtain theMappingMetamodelImplementor
Obtain theParameterMarkerStrategy
service.Obtain theQueryEngine
Obtain theRuntimeMetamodelsImplementor
Access to theServiceRegistry
for thisSessionFactory
.Get the options used to build this factory.Obtain theSqlStringGenerationContext
.Obtain theSqlTranslationEngine
Obtain theStatisticsImplementor
.TheJavaType
to use for a tenant identifier.Obtain theTypeConfiguration
getUuid()
The UUID assigned to thisSessionFactory
.Return an instance ofWrapperOptions
which is not backed by a session, and whose functionality is therefore incomplete.OverridesSessionFactory.openSession()
to widen the return type: this is useful for internal code depending onSessionFactoryImplementor
as it would otherwise need to frequently resort to casting to the internal contract.Get a non-transactional "current" session.Obtain a session builder for creating new instances ofSession
with certain customized options.Methods inherited from interface jakarta.persistence.EntityManagerFactory
addNamedEntityGraph, addNamedQuery, callInTransaction, getMetamodel, getNamedEntityGraphs, getNamedQueries, getPersistenceUnitUtil, getProperties, getTransactionType, isOpen, runInTransaction, unwrap
Methods inherited from interface javax.naming.Referenceable
getReference
Methods inherited from interface org.hibernate.SessionFactory
close, containsFetchProfileDefinition, createEntityManager, createEntityManager, createEntityManager, createEntityManager, createGraphForDynamicEntity, findEntityGraphsByType, fromSession, fromStatelessSession, fromStatelessTransaction, fromTransaction, getCriteriaBuilder, getCurrentSession, getDefinedFetchProfileNames, getDefinedFilterNames, getJndiName, getName, getSchemaManager, inSession, inStatelessSession, inStatelessTransaction, inTransaction, isClosed, openStatelessSession, openStatelessSession, withStatelessOptions
-
Method Details
-
getUuid
String getUuid()The UUID assigned to thisSessionFactory
.The value is generated as a
UUID
, but kept as a string. -
openSession
SessionImplementor openSession()OverridesSessionFactory.openSession()
to widen the return type: this is useful for internal code depending onSessionFactoryImplementor
as it would otherwise need to frequently resort to casting to the internal contract.- Specified by:
openSession
in interfaceSessionFactory
- Returns:
- the opened
Session
.
-
withOptions
SessionBuilderImplementor withOptions()Obtain a session builder for creating new instances ofSession
with certain customized options.- Specified by:
withOptions
in interfaceSessionFactory
- Returns:
- The session builder
-
openTemporarySession
SessionImplementor openTemporarySession()Get a non-transactional "current" session.- API Note:
- This is used by
hibernate-envers
.
-
getCache
CacheImplementor getCache()Obtain theCacheImplementor
.- Specified by:
getCache
in interfaceEntityManagerFactory
- Specified by:
getCache
in interfaceSessionFactory
- Returns:
- The direct cache access API.
-
getStatistics
StatisticsImplementor getStatistics()Obtain theStatisticsImplementor
.- Specified by:
getStatistics
in interfaceSessionFactory
- Returns:
- The statistics.
-
getTypeConfiguration
TypeConfiguration getTypeConfiguration()Obtain theTypeConfiguration
-
getRuntimeMetamodels
RuntimeMetamodelsImplementor getRuntimeMetamodels()Obtain theRuntimeMetamodelsImplementor
-
getMappingMetamodel
Obtain theMappingMetamodelImplementor
-
getJpaMetamodel
Obtain theJpaMetamodel
-
getQueryEngine
QueryEngine getQueryEngine()Obtain theQueryEngine
-
getSqlTranslationEngine
SqlTranslationEngine getSqlTranslationEngine()Obtain theSqlTranslationEngine
-
getServiceRegistry
ServiceRegistryImplementor getServiceRegistry()Access to theServiceRegistry
for thisSessionFactory
.- Returns:
- The factory's ServiceRegistry
-
getEventEngine
EventEngine getEventEngine()Get the EventEngine associated with this SessionFactory -
getFetchProfile
Deprecated, for removal: This API element is subject to removal in a future version.Retrieve a fetch profile by name.- Parameters:
name
- The name of the profile to retrieve.- Returns:
- The profile definition
-
getGenerator
Deprecated, for removal: This API element is subject to removal in a future version.Only used in one place, will be removedGet the identifier generator for the hierarchy -
getEntityNotFoundDelegate
EntityNotFoundDelegate getEntityNotFoundDelegate()Obtain theEntityNotFoundDelegate
-
addObserver
Register aSessionFactoryObserver
of this factory. -
getCustomEntityDirtinessStrategy
CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy()Obtain theCustomEntityDirtinessStrategy
-
getCurrentTenantIdentifierResolver
CurrentTenantIdentifierResolver<Object> getCurrentTenantIdentifierResolver()Obtain theCurrentTenantIdentifierResolver
-
getTenantIdentifierJavaType
TheJavaType
to use for a tenant identifier.- Since:
- 6.4
-
getEventListenerGroups
Access to the event listener groups.- Since:
- 7.0
-
getParameterMarkerStrategy
Obtain theParameterMarkerStrategy
service.- Since:
- 7.0
-
getJdbcValuesMappingProducerProvider
Obtain theJdbcServices
service.- Since:
- 7.0
-
getEntityCopyObserver
Obtain theEntityCopyObserverFactory
service.- Since:
- 7.0
-
getClassLoaderService
Obtain theClassLoaderService
.- Since:
- 7.0
-
getManagedBeanRegistry
Obtain theManagedBeanRegistry
service.- Since:
- 7.0
-
getEventListenerRegistry
Obtain theEventListenerRegistry
service.- Since:
- 7.0
-
getWrapperOptions
WrapperOptions getWrapperOptions()Return an instance ofWrapperOptions
which is not backed by a session, and whose functionality is therefore incomplete.- API Note:
- Avoid using this operation.
-
getSessionFactoryOptions
SessionFactoryOptions getSessionFactoryOptions()Get the options used to build this factory.- Specified by:
getSessionFactoryOptions
in interfaceSessionFactory
- Returns:
- The special options used to build the factory.
-
getFilterDefinition
Obtain the definition of a filter by name.- Specified by:
getFilterDefinition
in interfaceSessionFactory
- Parameters:
filterName
- The name of a declared filter- Returns:
- The filter definition.
-
getAutoEnabledFilters
Collection<FilterDefinition> getAutoEnabledFilters()Obtain a collection ofFilterDefinition
s representing all the auto-enabled filters. -
getJdbcServices
JdbcServices getJdbcServices()Obtain theJdbcServices
service. -
getSqlStringGenerationContext
SqlStringGenerationContext getSqlStringGenerationContext()Obtain theSqlStringGenerationContext
. -
findEntityGraphByName
Description copied from interface:SessionFactory
Return the rootEntityGraph
with the given name, ornull
if there is no graph with the given name.- Specified by:
findEntityGraphByName
in interfaceSessionFactory
- Parameters:
name
- the name given to someNamedEntityGraph
- Returns:
- an instance of
RootGraph
- See Also:
-
bestGuessEntityName
The best guess entity name for an entity not in an association
-
SqlAstCreationContext.getFetchProfile(String)