Interface SessionFactoryImplementor
- All Superinterfaces:
AutoCloseable, EntityManagerFactory, Referenceable, Serializable, SessionFactory
- All Known Implementing Classes:
SessionFactoryDelegatingImpl
Defines the internal contract between the
SessionFactory and the internal
implementation of Hibernate.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddObserver(SessionFactoryObserver observer) Register aSessionFactoryObserverof this factory.bestGuessEntityName(Object object) The best guess entity name for an entity not in an associationdefault <T> RootGraphImplementor<T> createEntityGraph(Class<T> entityType) Create anEntityGraphfor the given entity type.createGraphForDynamicEntity(String entityName) Create anEntityGraphwhich may be used from loading a dynamic entity withEntityManager.find(EntityGraph, Object, FindOption...).findEntityGraphByName(String name) Return the rootEntityGraphwith the given name, ornullif there is no graph with the given name.Obtain a collection ofFilterDefinitions representing all the auto-enabled filters.getCache()Obtain theCacheImplementor.Obtain theClassLoaderService.Obtain theCurrentTenantIdentifierResolverObtain theCustomEntityDirtinessStrategyObtain theEntityCopyObserverFactoryservice.Obtain theEntityNotFoundDelegateGet the EventEngine associated with this SessionFactoryAccess to the event listener groups.Obtain theEventListenerRegistryservice.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 removeddefault JdbcSelectWithActionsBuilderObtain theJdbcServicesservice.Obtain theJdbcServicesservice.default JpaMetamodelObtain theJpaMetamodelObtain theManagedBeanRegistryservice.default MappingMetamodelImplementorObtain theMappingMetamodelImplementorObtain theParameterMarkerStrategyservice.Obtain theQueryEngineObtain theRuntimeMetamodelsImplementorAccess to theServiceRegistryfor thisSessionFactory.Get the options used to build this factory.Obtain theSqlStringGenerationContext.Obtain theSqlTranslationEngineObtain theStatisticsImplementor.TheJavaTypeto use for a tenant identifier.Obtain theTypeConfigurationgetUuid()The UUID assigned to thisSessionFactory.Return an instance ofWrapperOptionswhich 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 onSessionFactoryImplementoras it would otherwise need to frequently resort to casting to the internal contract.Get a non-transactional "current" session.Object the current tenant identifier using the resolver.Obtain a session builder for creating new instances ofSessionwith certain customized options.Methods inherited from interface EntityManagerFactory
addNamedEntityGraph, addNamedQuery, callInTransaction, getMetamodel, getNamedEntityGraphs, getNamedQueries, getPersistenceUnitUtil, getProperties, getTransactionType, isOpen, runInTransaction, unwrapMethods inherited from interface Referenceable
getReferenceMethods inherited from interface SessionFactory
addNamedQuery, close, containsFetchProfileDefinition, createEntityManager, createEntityManager, createEntityManager, createEntityManager, findEntityGraphsByType, fromSession, fromStatelessSession, fromStatelessTransaction, fromTransaction, getCriteriaBuilder, getCurrentSession, getDefinedFetchProfileNames, getDefinedFilterNames, getJndiName, getName, getSchemaManager, inSession, inStatelessSession, inStatelessTransaction, inTransaction, isClosed, openStatelessSession, openStatelessSession, parseEntityGraph, parseEntityGraph, parseEntityGraph, withStatelessOptions
-
Method Details
-
getUuid
-
openSession
SessionImplementor openSession()OverridesSessionFactory.openSession()to widen the return type: this is useful for internal code depending onSessionFactoryImplementoras it would otherwise need to frequently resort to casting to the internal contract.- Specified by:
openSessionin interfaceSessionFactory- Returns:
- the opened
Session.
-
withOptions
SessionBuilderImplementor withOptions()Obtain a session builder for creating new instances ofSessionwith certain customized options.- Specified by:
withOptionsin 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:
getCachein interfaceEntityManagerFactory- Specified by:
getCachein interfaceSessionFactory- Returns:
- The direct cache access API.
-
getStatistics
StatisticsImplementor getStatistics()Obtain theStatisticsImplementor.- Specified by:
getStatisticsin 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 theServiceRegistryfor 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 aSessionFactoryObserverof this factory. -
getCustomEntityDirtinessStrategy
CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy()Obtain theCustomEntityDirtinessStrategy -
getCurrentTenantIdentifierResolver
CurrentTenantIdentifierResolver<Object> getCurrentTenantIdentifierResolver()Obtain theCurrentTenantIdentifierResolver -
resolveTenantIdentifier
Object the current tenant identifier using the resolver.- Since:
- 7.2
-
getTenantIdentifierJavaType
-
getEventListenerGroups
Access to the event listener groups.- Since:
- 7.0
-
getParameterMarkerStrategy
Obtain theParameterMarkerStrategyservice.- Since:
- 7.0
-
getJdbcValuesMappingProducerProvider
Obtain theJdbcServicesservice.- Since:
- 7.0
-
getEntityCopyObserver
Obtain theEntityCopyObserverFactoryservice.- Since:
- 7.0
-
getClassLoaderService
-
getManagedBeanRegistry
Obtain theManagedBeanRegistryservice.- Since:
- 7.0
-
getEventListenerRegistry
Obtain theEventListenerRegistryservice.- Since:
- 7.0
-
getWrapperOptions
WrapperOptions getWrapperOptions()Return an instance ofWrapperOptionswhich 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:
getSessionFactoryOptionsin interfaceSessionFactory- Returns:
- The special options used to build the factory.
-
getFilterDefinition
Obtain the definition of a filter by name.- Specified by:
getFilterDefinitionin interfaceSessionFactory- Parameters:
filterName- The name of a declared filter- Returns:
- The filter definition.
-
getAutoEnabledFilters
Collection<FilterDefinition> getAutoEnabledFilters()Obtain a collection ofFilterDefinitions representing all the auto-enabled filters. -
getJdbcServices
JdbcServices getJdbcServices()Obtain theJdbcServicesservice. -
getSqlStringGenerationContext
SqlStringGenerationContext getSqlStringGenerationContext()Obtain theSqlStringGenerationContext. -
findEntityGraphByName
Description copied from interface:SessionFactoryReturn the rootEntityGraphwith the given name, ornullif there is no graph with the given name.- Specified by:
findEntityGraphByNamein interfaceSessionFactory- Parameters:
name- the name given to someNamedEntityGraph- Returns:
- an instance of
RootGraph - See Also:
-
createEntityGraph
Description copied from interface:SessionFactoryCreate anEntityGraphfor the given entity type.- Specified by:
createEntityGraphin interfaceSessionFactory- Parameters:
entityType- The entity type for the graph- See Also:
-
createGraphForDynamicEntity
Description copied from interface:SessionFactoryCreate anEntityGraphwhich may be used from loading a dynamic entity withEntityManager.find(EntityGraph, Object, FindOption...).This allows a dynamic entity to be loaded without the need for a cast.
var MyDynamicEntity_ = factory.createGraphForDynamicEntity("MyDynamicEntity"); Map<String,?> myDynamicEntity = session.find(MyDynamicEntity_, id);- Specified by:
createGraphForDynamicEntityin interfaceSessionFactory- Parameters:
entityName- The name of the dynamic entity- See Also:
-
bestGuessEntityName
-
getJdbcSelectWithActionsBuilder
-
SqlAstCreationContext.getFetchProfile(String)