Top Description Inners Fields Constructors Methods
org.hibernate.internal

public Class SessionFactoryImpl

extends Object
implements SessionFactoryImplementor
Class Inheritance
All Implemented Interfaces
org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.query.spi.QueryParameterBindingTypeResolver, org.hibernate.SessionFactory, java.io.Closeable, java.lang.AutoCloseable, java.io.Serializable, javax.naming.Referenceable, org.hibernate.jpa.HibernateEntityManagerFactory, javax.persistence.EntityManagerFactory, org.hibernate.engine.spi.Mapping
Imports
java.io.IOException, .InvalidObjectException, .ObjectInputStream, .ObjectOutputStream, java.sql.Connection, java.util.ArrayList, .Collections, .HashMap, .List, .Map, .Set, .TimeZone, java.util.function.Supplier, javax.naming.Reference, .StringRefAddr, javax.persistence.EntityGraph, .EntityManagerFactory, .PersistenceContextType, .PersistenceException, .PersistenceUnitUtil, .Query, .SynchronizationType, javax.persistence.criteria.CriteriaBuilder, org.hibernate.ConnectionAcquisitionMode, .ConnectionReleaseMode, .CustomEntityDirtinessStrategy, .EmptyInterceptor, .FlushMode, .HibernateException, .Interceptor, .MappingException, .Session, .SessionBuilder, .SessionEventListener, .SessionFactory, .SessionFactoryObserver, .StatelessSession, .StatelessSessionBuilder, .TypeHelper, org.hibernate.boot.cfgxml.spi.CfgXmlAccessService, .LoadedConfig, org.hibernate.boot.model.relational.SqlStringGenerationContext, org.hibernate.boot.model.relational.internal.SqlStringGenerationContextImpl, org.hibernate.boot.registry.classloading.spi.ClassLoaderService, org.hibernate.boot.spi.MetadataImplementor, .SessionFactoryOptions, org.hibernate.cache.spi.CacheImplementor, org.hibernate.cfg.AvailableSettings, .Environment, .Settings, org.hibernate.context.internal.JTASessionContext, .ManagedSessionContext, .ThreadLocalSessionContext, org.hibernate.context.spi.CurrentSessionContext, .CurrentTenantIdentifierResolver, org.hibernate.dialect.function.SQLFunctionRegistry, org.hibernate.engine.config.spi.ConfigurationService, org.hibernate.engine.jdbc.connections.spi.ConnectionProvider, .JdbcConnectionAccess, .MultiTenantConnectionProvider, org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator, org.hibernate.engine.jdbc.spi.JdbcServices, org.hibernate.engine.jndi.spi.JndiService, org.hibernate.engine.profile.Association, .Fetch, .FetchProfile, org.hibernate.engine.query.spi.QueryPlanCache, .ReturnMetadata, org.hibernate.engine.spi.FilterDefinition, .NamedQueryDefinition, .NamedQueryDefinitionBuilder, .NamedSQLQueryDefinition, .NamedSQLQueryDefinitionBuilder, .SessionBuilderImplementor, .SessionFactoryImplementor, .SessionOwner, org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform, org.hibernate.event.service.spi.EventListenerGroup, .EventListenerRegistry, org.hibernate.event.spi.EventEngine, .EventType, org.hibernate.graph.spi.RootGraphImplementor, org.hibernate.id.IdentifierGenerator, org.hibernate.id.factory.IdentifierGeneratorFactory, org.hibernate.integrator.spi.Integrator, .IntegratorService, org.hibernate.internal.util.config.ConfigurationException, .ConfigurationHelper, org.hibernate.jpa.internal.AfterCompletionActionLegacyJpaImpl, .ExceptionMapperLegacyJpaImpl, .ManagedFlushCheckerLegacyJpaImpl, .PersistenceUnitUtilImpl, org.hibernate.mapping.RootClass, org.hibernate.metadata.ClassMetadata, .CollectionMetadata, org.hibernate.metamodel.internal.MetamodelImpl, org.hibernate.metamodel.spi.MetamodelImplementor, org.hibernate.persister.entity.EntityPersister, .Loadable, org.hibernate.procedure.ProcedureCall, org.hibernate.proxy.EntityNotFoundDelegate, .HibernateProxyHelper, org.hibernate.query.NativeQuery, org.hibernate.query.criteria.internal.CriteriaBuilderImpl, org.hibernate.query.spi.NamedQueryRepository, org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode, .StatementInspector, org.hibernate.resource.transaction.backend.jta.internal.synchronization.AfterCompletionAction, .ExceptionMapper, .ManagedFlushChecker, org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder, org.hibernate.secure.spi.GrantedPermission, .JaccPermissionDeclarations, .JaccService, org.hibernate.service.spi.ServiceRegistryImplementor, .SessionFactoryServiceRegistry, .SessionFactoryServiceRegistryFactory, org.hibernate.stat.spi.StatisticsImplementor, org.hibernate.tool.schema.spi.DelayedDropAction, .SchemaManagementToolCoordinator, org.hibernate.type.SerializableType, .Type, .TypeResolver, org.jboss.logging.Logger

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Concrete implementation of the SessionFactory interface. Has the following responsibilities This class must appear immutable to clients, even if it does all kinds of caching and pooling under the covers. It is crucial that the class is not only thread safe, but also highly concurrent. Synchronization must be used extremely sparingly.
Authors
Gavin King, Steve Ebersole, Chris Cranford

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
private static enum

Field Summary

Modifier and TypeField and Description
private final transient CacheImplementor
cacheAccess

Deprecated as a consequence of CacheImplementor being deprecated.
private final transient CriteriaBuilderImpl
private final transient CurrentSessionContext
private final transient SessionBuilder<T extends SessionBuilder>
private final transient StatelessSessionBuilder<T extends StatelessSessionBuilder>
private volatile DelayedDropAction
private final transient EventEngine
private final transient FastSessionServices
private final transient Map<String, FetchProfile>
private final transient Map<String, FilterDefinition>
private final transient Map<String, IdentifierGenerator>
private final transient JdbcServices
private final PersistenceUnitUtil
private static final CoreMessageLogger
private final transient MetamodelImplementor
private final String
private final transient NamedQueryRepository
private final transient SessionFactoryObserverChain
private transient PersistenceContextType
private final transient Map<String, Object>
private final transient QueryPlanCache
private final transient SessionFactoryServiceRegistry
private final transient SessionFactoryOptions
private final transient Settings
settings

Deprecated as a consequence of Settings being deprecated.
private final transient SQLFunctionRegistry
private final transient SqlStringGenerationContext
private transient StatisticsImplementor
private transient volatile SessionFactoryImpl.Status
private transient SynchronizationType
private final transient SessionBuilder<T extends SessionBuilder>
private final transient TypeHelper
private final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public <T> void
addNamedEntityGraph(String
name for the entity graph
graphName
,
EntityGraph<T>
entity graph
entityGraph
)

Implements javax.persistence.EntityManagerFactory.addNamedEntityGraph.

Add a named copy of the EntityGraph to the EntityManagerFactory.
public void
addNamedQuery(String
name for the query
name
,
Query
Query, TypedQuery, or StoredProcedureQuery object
query
)

Implements javax.persistence.EntityManagerFactory.addNamedQuery.

Define the query, typed query, or stored procedure query as a named query such that future query objects can be created from it using the createNamedQuery or createNamedStoredProcedureQuery method.
private void
addNamedStoredProcedureQuery(String name, ProcedureCall procedureCall)

Deprecated as a consequence of ProcedureCall being deprecated.
public void
private void
private CurrentSessionContext
private <K, V> Session
buildEntityManager(final SynchronizationType synchronizationType, final Map<K, V> map)

Deprecated as a consequence of Session being deprecated.
private JdbcConnectionAccess
private SessionBuilder<T extends SessionBuilder>
private boolean
private Map<String, HibernateException>
public void
close()

Implements org.hibernate.SessionFactory.close.

Closes the session factory, releasing all held resources.
public static Interceptor
public static Interceptor
configuredInterceptor(Interceptor interceptor, boolean explicitNoInterceptor, SessionFactoryOptions options)

public boolean
containsFetchProfileDefinition(String
The name to check
name
)

Implements org.hibernate.SessionFactory.containsFetchProfileDefinition.

Determine if this session factory contains a fetch profile definition registered under the given name.
private SessionBuilder<T extends SessionBuilder>
public Session
createEntityManager()

Implements javax.persistence.EntityManagerFactory.createEntityManager.

Deprecated as a consequence of Session being deprecated.
Create a new application-managed EntityManager.
public Session
createEntityManager(Map<K, V>
properties for entity manager
map
)

Implements javax.persistence.EntityManagerFactory.createEntityManager.

Deprecated as a consequence of Session being deprecated.
Create a new application-managed EntityManager with the specified Map of properties.
public Session
createEntityManager(SynchronizationType
how and when the entity manager should be synchronized with the current JTA transaction
synchronizationType
)

Implements javax.persistence.EntityManagerFactory.createEntityManager.

Deprecated as a consequence of Session being deprecated.
Create a new JTA application-managed EntityManager with the specified synchronization type.
public Session
createEntityManager(SynchronizationType
how and when the entity manager should be synchronized with the current JTA transaction
synchronizationType
,
Map<K, V>
properties for entity manager
map
)

Implements javax.persistence.EntityManagerFactory.createEntityManager.

Deprecated as a consequence of Session being deprecated.
Create a new JTA application-managed EntityManager with the specified synchronization type and map of properties.
pack-priv static SessionFactoryImpl

Returns:

The deserialized factory
deserialize
(ObjectInputStream
The stream from which to "read" the factory
ois
)

Deprecated as a consequence of SessionFactoryImpl being deprecated.
Custom deserialization hook used during Session deserialization.
private void
private NamedQueryDefinition
extractHqlQueryDefinition(Query<R> hqlQuery, String name)

Deprecated as a consequence of Query being deprecated.
private NamedSQLQueryDefinition
extractSqlQueryDefinition(NativeQuery<T> nativeSqlQuery, String name)

Deprecated as a consequence of NativeQuery being deprecated.
private void
fillInNamedQueryBuilder(NamedQueryDefinitionBuilder builder, Query<R> query)

Deprecated as a consequence of Query being deprecated.
public RootGraphImplementor<J>
public <T> List<RootGraphImplementor<? super T>>
public Map<String, ClassMetadata>
getAllClassMetadata()

Implements org.hibernate.SessionFactory.getAllClassMetadata.

Retrieve the ClassMetadata for all mapped entities.
public Map<K, V>
public CacheImplementor
getCache()

Implements org.hibernate.engine.spi.SessionFactoryImplementor.getCache.

Deprecated as a consequence of CacheImplementor being deprecated.
Obtain direct access to the underlying cache regions.
public ClassMetadata
getClassMetadata(Class<T>
The entity class
persistentClass
)

Implements org.hibernate.SessionFactory.getClassMetadata.

Retrieve the ClassMetadata associated with the given entity class.
public ClassMetadata
getClassMetadata(String
The entity class
entityName
)

Implements org.hibernate.SessionFactory.getClassMetadata.

Retrieve the ClassMetadata associated with the given entity class.
public CollectionMetadata
getCollectionMetadata(String
The collection role (in form [owning-entity-name].[collection-property-name]).
roleName
)

Implements org.hibernate.SessionFactory.getCollectionMetadata.

Get the CollectionMetadata associated with the named collection role.
public CriteriaBuilder
getCriteriaBuilder()

Implements javax.persistence.EntityManagerFactory.getCriteriaBuilder.

Return an instance of CriteriaBuilder for the creation of CriteriaQuery objects.
public Session
getCurrentSession()

Implements org.hibernate.SessionFactory.getCurrentSession.

Deprecated as a consequence of Session being deprecated.
Obtains the current session.
public CurrentTenantIdentifierResolver
public CustomEntityDirtinessStrategy
public Set<E>
getDefinedFilterNames()

Implements org.hibernate.SessionFactory.getDefinedFilterNames.

Obtain a set of the names of all filters defined on this SessionFactory.
public SessionFactoryImplementor.DeserializationResolver<T extends SessionFactoryImplementor>
public EntityNotFoundDelegate
public EventEngine
getEventEngine()

Implements org.hibernate.engine.spi.SessionFactoryImplementor.getEventEngine.

Get the EventEngine associated with this SessionFactory
public FastSessionServices

Returns:

the FastSessionServices for this SessionFactory.
getFastSessionServices
()

Implements org.hibernate.engine.spi.SessionFactoryImplementor.getFastSessionServices.

public FetchProfile
getFetchProfile(String
The name of the profile to retrieve.
name
)

Implements org.hibernate.engine.spi.SessionFactoryImplementor.getFetchProfile.

Retrieve fetch profile by name.
public FilterDefinition
getFilterDefinition(String
The name of the filter for which to obtain the definition.
filterName
)

Implements org.hibernate.SessionFactory.getFilterDefinition.

Obtain the definition of a filter by name.
public IdentifierGenerator
getIdentifierGenerator(String rootEntityName)

Implements org.hibernate.engine.spi.SessionFactoryImplementor.getIdentifierGenerator.

Deprecated as a consequence of IdentifierGenerator being deprecated.
Get the identifier generator for the hierarchy
public IdentifierGeneratorFactory
getIdentifierGeneratorFactory()

Implements org.hibernate.engine.spi.Mapping.getIdentifierGeneratorFactory.

Allow access to the id generator factory, though this is only needed/allowed from configuration.
public String
public Type
public Interceptor
getInterceptor()

Implements org.hibernate.engine.spi.SessionFactoryImplementor.getInterceptor.

Get the factory scoped interceptor for this factory.
public JdbcServices
public MetamodelImplementor
getMetamodel()

Implements org.hibernate.engine.spi.SessionFactoryImplementor.getMetamodel.

Return an instance of Metamodel interface for access to the metamodel of the persistence unit.
public String
getName()

Implements org.hibernate.engine.spi.SessionFactoryImplementor.getName.

Access to the name (if one) assigned to the SessionFactory
public NamedQueryRepository
public PersistenceUnitUtil
getPersistenceUnitUtil()

Implements javax.persistence.EntityManagerFactory.getPersistenceUnitUtil.

Return interface providing access to utility methods for the persistence unit.
public Map<String, Object>
getProperties()

Implements javax.persistence.EntityManagerFactory.getProperties.

Get the properties and associated values that are in effect for the entity manager factory.
public QueryPlanCache
getQueryPlanCache()

Implements org.hibernate.engine.spi.SessionFactoryImplementor.getQueryPlanCache.

Access to the caches of HQL/JPQL and native query plans.
public Reference
getReference()

Implements javax.naming.Referenceable.getReference.

Retrieves the Reference of this object.
public Type
public String[]
getReturnAliases(String queryString)

Overrides default org.hibernate.engine.spi.SessionFactoryImplementor.getReturnAliases.

Get the return aliases of a query
public Type[]
getReturnTypes(String queryString)

Overrides default org.hibernate.engine.spi.SessionFactoryImplementor.getReturnTypes.

Get the return types of a query
public ServiceRegistryImplementor
getServiceRegistry()

Implements org.hibernate.engine.spi.SessionFactoryImplementor.getServiceRegistry.

Access to the ServiceRegistry for this SessionFactory.
public SessionFactoryOptions
getSessionFactoryOptions()

Implements org.hibernate.SessionFactory.getSessionFactoryOptions.

Get the special options used to build the factory.
public Settings
getSettings()

Implements org.hibernate.engine.spi.SessionFactoryImplementor.getSettings.

Deprecated as a consequence of Settings being deprecated.
public SQLFunctionRegistry
public SqlStringGenerationContext
public StatisticsImplementor
getStatistics()

Implements org.hibernate.engine.spi.SessionFactoryImplementor.getStatistics.

Retrieve the statistics for this factory.
public TypeHelper
public TypeResolver

Returns:

The type resolver
getTypeResolver
()

Implements org.hibernate.engine.spi.SessionFactoryImplementor.getTypeResolver.

Deprecated (since 5.3) No replacement, access to and handling of Types will be much different in 6.0
Retrieve the Type resolver associated with this factory.
public String
getUuid()

Implements org.hibernate.engine.spi.SessionFactoryImplementor.getUuid.

Get the UUID for this SessionFactory.
public boolean
isClosed()

Implements org.hibernate.SessionFactory.isClosed.

Is this factory already closed?
public boolean
isOpen()

Implements javax.persistence.EntityManagerFactory.isOpen.

Indicates whether the factory is open.
private static SessionFactory
locateSessionFactoryOnDeserialization(String uuid, String name)

Deprecated as a consequence of SessionFactory being deprecated.
private void
private void
maskOutIfSet(Map<String, Object> props, String setting)

private void
public Session
openSession()

Implements org.hibernate.SessionFactory.openSession.

Deprecated as a consequence of Session being deprecated.
Open a Session.
public StatelessSession
public StatelessSession
openStatelessSession(Connection
Connection provided by the application.
connection
)

Implements org.hibernate.SessionFactory.openStatelessSession.

Open a new stateless session, utilizing the specified JDBC Connection.
public Session
openTemporarySession()

Implements org.hibernate.engine.spi.SessionFactoryImplementor.openTemporarySession.

Deprecated as a consequence of Session being deprecated.
Get a non-transactional "current" session (used by hibernate-envers)
private void
readObject(ObjectInputStream
The stream from which the object is being deserialized.
in
)

Custom serialization hook defined by Java spec.

private Object

Returns:

The resolved factory to use.
readResolve
()

Custom serialization hook defined by Java spec.

public Type
public Type
pack-priv void
serialize(ObjectOutputStream
The stream to which to write the factory
oos
)

Custom serialization hook used during Session serialization.

public <T> T
unwrap(Class<T>
the class of the object to be returned. This is normally either the underlying EntityManagerFactory implementation class or an interface that it implements.
type
)

Implements javax.persistence.EntityManagerFactory.unwrap.

Return an object of the specified type to allow access to the provider-specific API.
protected void
public SessionBuilderImplementor<T extends SessionBuilder<T extends SessionBuilder>>
public StatelessSessionBuilder<T extends StatelessSessionBuilder>
private void
writeObject(ObjectOutputStream
The stream into which the object is being serialized.
out
)

Custom serialization hook defined by Java spec.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait