Interface SessionFactoryImplementor
- All Superinterfaces:
AutoCloseable, EntityManagerFactory, Referenceable, Serializable, SessionFactory
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 withEntityHandler.find(EntityGraph, Object, FindOption...).findEntityGraphByName(String name) Return the rootEntityGraphwith the given name, ornullif there is no graph with the given name.Access to the factory for ActionQueue instances configured for this factory.Obtain a collection ofFilterDefinitions representing all the auto-enabled filters.getCache()Obtain theCacheImplementor.Efficient access to theChangesetCoordinator.Obtain theClassLoaderService.Obtain theCurrentTenantIdentifierResolverObtain theCustomEntityDirtinessStrategyObtain theEntityCopyObserverFactoryservice.Obtain theEntityNotFoundDelegateGet the EventEngine associated with this SessionFactoryAccess to the event listener groups.Obtain theEventListenerRegistryservice.getFilterDefinition(String filterName) Obtain the definition of a filter by name.Configuration for graph planning as part of the ActionQueue.default 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 theSqlTranslationEngineAccess to the StatementObserver associated with this factory.Obtain 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.default <T> RootGraph<T> parseEntityGraph(CharSequence graphText) Creates aRootGraphbased on the passed string representation.default <T> RootGraph<T> parseEntityGraph(Class<T> rootEntityClass, CharSequence graphText) Creates aRootGraphfor the givenrootEntityClassand parses the graph text into it.default <T> RootGraph<T> parseEntityGraph(String rootEntityName, CharSequence graphText) Creates aRootGraphfor the givenrootEntityNameand parses the graph text into it.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
addListener, addNamedEntityGraph, addNamedQuery, addNamedStatement, callInTransaction, callInTransaction, createEntityAgent, getMetamodel, getNamedEntityGraphs, getNamedQueries, getNamedStatements, getPersistenceUnitUtil, getProperties, getResultSetMappings, getTransactionType, isOpen, runInTransaction, runInTransaction, unwrapMethods inherited from interface Referenceable
getReferenceMethods inherited from interface SessionFactory
addNamedQuery, close, containsFetchProfileDefinition, createEntityAgent, createEntityManager, createEntityManager, createEntityManager, createEntityManager, findEntityGraphsByType, fromSession, fromStatelessSession, fromStatelessTransaction, fromTransaction, getCriteriaBuilder, getCurrentSession, getDefinedFetchProfileNames, getDefinedFilterNames, getJndiName, getName, getSchemaManager, inSession, inStatelessSession, inStatelessTransaction, inTransaction, isClosed, openStatelessSession, openStatelessSession, withStatelessOptions
-
Method Details
-
getUuid
-
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
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
Obtain theCacheImplementor.- Specified by:
getCachein interfaceEntityManagerFactory- Specified by:
getCachein interfaceSessionFactory- Returns:
- The direct cache access API, which is never null, not even when the second-level cache is disabled.
-
getStatistics
Obtain theStatisticsImplementor.- Specified by:
getStatisticsin interfaceSessionFactory- Returns:
- The statistics.
-
getTypeConfiguration
Obtain theTypeConfiguration -
getRuntimeMetamodels
Obtain theRuntimeMetamodelsImplementor -
getMappingMetamodel
Obtain theMappingMetamodelImplementor -
getJpaMetamodel
Obtain theJpaMetamodel -
getQueryEngine
Obtain theQueryEngine -
getSqlTranslationEngine
Obtain theSqlTranslationEngine -
getServiceRegistry
Access to theServiceRegistryfor thisSessionFactory.- Returns:
- The factory's ServiceRegistry
-
getEventEngine
Get the EventEngine associated with this SessionFactory -
getEntityNotFoundDelegate
Obtain theEntityNotFoundDelegate -
addObserver
Register aSessionFactoryObserverof this factory. -
getCustomEntityDirtinessStrategy
Obtain theCustomEntityDirtinessStrategy -
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
Obtain theClassLoaderService.- Since:
- 7.0
-
getManagedBeanRegistry
Obtain theManagedBeanRegistryservice.- Since:
- 7.0
-
getEventListenerRegistry
Obtain theEventListenerRegistryservice.- Since:
- 7.0
-
getChangesetCoordinator
Efficient access to theChangesetCoordinator. -
getGraphPlanningOptions
Configuration for graph planning as part of the ActionQueue. -
getWrapperOptions
Return an instance ofWrapperOptionswhich is not backed by a session, and whose functionality is therefore incomplete.- API Note:
- Avoid using this operation.
-
getSessionFactoryOptions
Get the options used to build this factory.- Specified by:
getSessionFactoryOptionsin interfaceSessionFactory- Returns:
- The special options used to build the factory.
-
getStatementObserver
Access to the StatementObserver associated with this 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
Obtain a collection ofFilterDefinitions representing all the auto-enabled filters. -
getJdbcServices
Obtain theJdbcServicesservice. -
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
@Nonnull RootGraphImplementor<Map<String,?>> createGraphForDynamicEntity(@Nonnull String entityName) Description copied from interface:SessionFactoryCreate anEntityGraphwhich may be used from loading a dynamic entity withEntityHandler.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
-
parseEntityGraph
@Nonnull default <T> RootGraph<T> parseEntityGraph(@Nonnull Class<T> rootEntityClass, @Nonnull CharSequence graphText) Description copied from interface:SessionFactoryCreates aRootGraphfor the givenrootEntityClassand parses the graph text into it.- Specified by:
parseEntityGraphin interfaceSessionFactory- Parameters:
rootEntityClass- The entity class to use as the base of the created root-graphgraphText- The textual representation of the graph- See Also:
-
parseEntityGraph
@Incubating @Nonnull default <T> RootGraph<T> parseEntityGraph(@Nonnull String rootEntityName, @Nonnull CharSequence graphText) Description copied from interface:SessionFactoryCreates aRootGraphfor the givenrootEntityNameand parses the graph text into it.- Specified by:
parseEntityGraphin interfaceSessionFactory- Parameters:
rootEntityName- The name of the entity to use as the base of the created root-graphgraphText- The textual representation of the graph- See Also:
-
parseEntityGraph
Description copied from interface:SessionFactoryCreates aRootGraphbased on the passed string representation. Here, the string representation is expected to include the root entity name.- Specified by:
parseEntityGraphin interfaceSessionFactory- Parameters:
graphText- The textual representation of the graph
-
getActionQueueFactory
Access to the factory for ActionQueue instances configured for this factory.
-