Top Description Inners Fields Constructors Methods
org.hibernate.impl

public final Class SessionFactoryImpl

extends Object
implements SessionFactory, SessionFactoryImplementor
Class Inheritance
All Implemented Interfaces
org.hibernate.engine.SessionFactoryImplementor, org.hibernate.SessionFactory, java.io.Serializable, javax.naming.Referenceable, org.hibernate.engine.Mapping
Imports
java.io.IOException, .InvalidObjectException, .ObjectInputStream, .ObjectOutputStream, .ObjectStreamException, .Serializable, java.sql.Connection, java.util.ArrayList, .Collections, .HashMap, .HashSet, .Iterator, .LinkedHashSet, .Map, .Properties, .Set, java.util.concurrent.ConcurrentHashMap, .ConcurrentMap, javax.naming.NamingException, .Reference, .StringRefAddr, javax.transaction.TransactionManager, org.slf4j.Logger, .LoggerFactory, org.hibernate.AssertionFailure, .Cache, .ConnectionReleaseMode, .EntityMode, .EntityNameResolver, .HibernateException, .Interceptor, .MappingException, .ObjectNotFoundException, .QueryException, .SessionFactory, .SessionFactoryObserver, .StatelessSession, .TypeHelper, org.hibernate.cache.CacheKey, .CollectionRegion, .EntityRegion, .QueryCache, .Region, .UpdateTimestampsCache, org.hibernate.cache.access.AccessType, .CollectionRegionAccessStrategy, .EntityRegionAccessStrategy, org.hibernate.cache.impl.CacheDataDescriptionImpl, org.hibernate.cfg.Configuration, .Environment, .Settings, org.hibernate.connection.ConnectionProvider, org.hibernate.context.CurrentSessionContext, .JTASessionContext, .ManagedSessionContext, .ThreadLocalSessionContext, org.hibernate.dialect.Dialect, org.hibernate.dialect.function.SQLFunctionRegistry, org.hibernate.engine.FilterDefinition, .Mapping, .NamedQueryDefinition, .NamedSQLQueryDefinition, .ResultSetMappingDefinition, .SessionFactoryImplementor, org.hibernate.engine.profile.Association, .Fetch, .FetchProfile, org.hibernate.engine.query.QueryPlanCache, org.hibernate.engine.query.sql.NativeSQLQuerySpecification, org.hibernate.event.EventListeners, org.hibernate.exception.SQLExceptionConverter, org.hibernate.id.IdentifierGenerator, .UUIDGenerator, org.hibernate.id.factory.IdentifierGeneratorFactory, org.hibernate.jdbc.BatcherFactory, org.hibernate.mapping.Collection, .PersistentClass, .RootClass, org.hibernate.metadata.ClassMetadata, .CollectionMetadata, org.hibernate.persister.PersisterFactory, org.hibernate.persister.collection.CollectionPersister, org.hibernate.persister.entity.EntityPersister, .Loadable, .Queryable, org.hibernate.pretty.MessageHelper, org.hibernate.proxy.EntityNotFoundDelegate, org.hibernate.stat.ConcurrentStatisticsImpl, .Statistics, .StatisticsImplementor, org.hibernate.tool.hbm2ddl.SchemaExport, .SchemaUpdate, .SchemaValidator, org.hibernate.transaction.TransactionFactory, org.hibernate.tuple.entity.EntityTuplizer, org.hibernate.type.AssociationType, .Type, .TypeResolver, org.hibernate.util.CollectionHelper, .EmptyIterator, .ReflectHelper

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.
Author
Gavin King
See Also
org.hibernate.connection.ConnectionProvider, org.hibernate.classic.Session, org.hibernate.hql.QueryTranslator, org.hibernate.persister.entity.EntityPersister, org.hibernate.persister.collection.CollectionPersister

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final transient ConcurrentMap<String, Region>
private final transient Cache
private final transient Map<String, ClassMetadata>
private final transient Map<K, V>
private final transient Map<K, V>
private final transient Map<String, Set<String>>
private final transient CurrentSessionContext
private final transient HashMap<K, V>
private final transient EntityNotFoundDelegate
private final transient Map<K, V>
private final transient EventListeners
private final transient Map<K, V>
private final transient Map<K, V>
private final transient Map<K, V>
private final transient Map<K, V>
private final transient Interceptor
private transient boolean
private static final Logger
private final String
private final transient Map<K, V>
private final transient Map<K, V>
private final transient SessionFactoryObserver
private final transient Properties
private final transient QueryCache
private final transient Map<String, QueryCache>
private final transient QueryPlanCache
private transient SchemaExport
private final transient Settings
private final transient SQLFunctionRegistry
private final transient Map<K, V>
private final transient Statistics
private final transient TransactionManager
private final transient TypeHelper
private final transient TypeResolver
private final transient UpdateTimestampsCache
private final String
private static final IdentifierGenerator

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private CurrentSessionContext
private Map<K, V>
public void
close()

Implements org.hibernate.SessionFactory.close.

Closes the session factory, releasing all held resources.
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.
pack-priv static SessionFactoryImpl

Returns:

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

Custom deserialization hook used during Session deserialization.

public void
evict(Class<T>
The entity class for which to evict data.
persistentClass
,
Serializable
The entity id
id
)

Implements org.hibernate.SessionFactory.evict.

Evict an entry from the second-level cache.
public void
evict(Class<T>
The entity class for which to evict data.
persistentClass
)

Implements org.hibernate.SessionFactory.evict.

Evict all entries from the second-level cache.
public void
evictCollection(String
The name of the collection role
roleName
,
Serializable
The id of the collection owner
id
)

Implements org.hibernate.SessionFactory.evictCollection.

Evict an entry from the second-level cache.
public void
evictCollection(String
The name of the collection role whose regions should be evicted
roleName
)

Implements org.hibernate.SessionFactory.evictCollection.

Evict all entries from the second-level cache.
public void
evictEntity(String
The entity name for which to evict data.
entityName
,
Serializable
The entity id
id
)

Implements org.hibernate.SessionFactory.evictEntity.

Evict an entry from the second-level cache.
public void
evictEntity(String
The entity name for which to evict data.
entityName
)

Implements org.hibernate.SessionFactory.evictEntity.

Evict all entries from the second-level cache.
public void
evictQueries()

Implements org.hibernate.SessionFactory.evictQueries.

Evict any query result sets cached in the default query cache region.
public void
evictQueries(String
The named query cache region from which to evict.
regionName
)

Implements org.hibernate.SessionFactory.evictQueries.

Evict any query result sets cached in the named query cache region.
public Map<String, ClassMetadata>
getAllClassMetadata()

Implements org.hibernate.SessionFactory.getAllClassMetadata.

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

Implements org.hibernate.engine.SessionFactoryImplementor.getAllSecondLevelCacheRegions.

Get a map of all the second level cache regions currently maintained in this session factory.
public BatcherFactory
public Cache
getCache()

Implements org.hibernate.SessionFactory.getCache.

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 CollectionPersister
getCollectionPersister(String
The role (name) of the collection for which to retrieve the persister.
role
)

Implements org.hibernate.engine.SessionFactoryImplementor.getCollectionPersister.

Get the persister object for a collection role.
public Set<String>
getCollectionRolesByEntityParticipant(String
The entity name for which to get the collection roles.
entityName
)

Implements org.hibernate.engine.SessionFactoryImplementor.getCollectionRolesByEntityParticipant.

Retrieves a set of all the collection roles in which the given entity is a participant, as either an index or an element.
public ConnectionProvider
public Session
getCurrentSession()

Implements org.hibernate.SessionFactory.getCurrentSession.

Obtains the current session.
public Set<E>
getDefinedFilterNames()

Implements org.hibernate.SessionFactory.getDefinedFilterNames.

Obtain a set of the names of all filters defined on this SessionFactory.
public Dialect
public EntityNotFoundDelegate
public EntityPersister
getEntityPersister(String
The name of the entity for which to retrieve the persister.
entityName
)

Implements org.hibernate.engine.SessionFactoryImplementor.getEntityPersister.

Get the persister for the named entity
public EventListeners
public SessionFactoryObserver
getFactoryObserver()

Implements org.hibernate.engine.SessionFactoryImplementor.getFactoryObserver.

Return the SessionFactoryObserver attached to the SessionFactory if any
public FetchProfile
getFetchProfile(String
The name of the profile to retrieve.
name
)

Implements org.hibernate.engine.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.SessionFactoryImplementor.getIdentifierGenerator.

Get the identifier generator for the hierarchy
public IdentifierGeneratorFactory
getIdentifierGeneratorFactory()

Implements org.hibernate.engine.Mapping.getIdentifierGeneratorFactory.

Allow access to the id generator factory, though this is only needed/allowed from configuration.
public String
public Type
public String[]
getImplementors(String className)

Implements org.hibernate.engine.SessionFactoryImplementor.getImplementors.

Return the names of all persistent (mapped) classes that extend or implement the given class or interface, accounting for implicit/explicit polymorphism settings and excluding mapped subclasses/joined-subclasses of other classes in the result.
public String
getImportedClassName(String className)

Implements org.hibernate.engine.SessionFactoryImplementor.getImportedClassName.

Get a class name, using query language imports
public Interceptor
getInterceptor()

Implements org.hibernate.engine.SessionFactoryImplementor.getInterceptor.

Get the factory scoped interceptor for this factory.
public NamedQueryDefinition
public NamedSQLQueryDefinition
public Properties
getProperties()

Implements org.hibernate.engine.SessionFactoryImplementor.getProperties.

Get a copy of the Properties used to configure this session factory.
public QueryCache
public QueryCache
getQueryCache(String
the name of the cache region, or null for the default query cache
regionName
)

Implements org.hibernate.engine.SessionFactoryImplementor.getQueryCache.

Get a particular named query cache, or the default cache
public QueryPlanCache
public Reference
getReference()

Implements javax.naming.Referenceable.getReference.

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

Implements org.hibernate.engine.SessionFactoryImplementor.getReturnAliases.

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

Implements org.hibernate.engine.SessionFactoryImplementor.getReturnTypes.

Get the return types of a query
public Region
getSecondLevelCacheRegion(String
The name of the region to retrieve.
regionName
)

Implements org.hibernate.engine.SessionFactoryImplementor.getSecondLevelCacheRegion.

Get a named second-level cache region
public Settings
public SQLExceptionConverter
getSQLExceptionConverter()

Implements org.hibernate.engine.SessionFactoryImplementor.getSQLExceptionConverter.

Retrieves the SQLExceptionConverter in effect for this SessionFactory.
public SQLFunctionRegistry
public Statistics
getStatistics()

Implements org.hibernate.SessionFactory.getStatistics.

Retrieve the statistics fopr this factory.
public StatisticsImplementor
public TransactionFactory
public TransactionManager
public TypeHelper
public TypeResolver
getTypeResolver()

Implements org.hibernate.engine.SessionFactoryImplementor.getTypeResolver.

Retrieve the Type resolver associated with this factory.
public UpdateTimestampsCache
public boolean
isClosed()

Implements org.hibernate.SessionFactory.isClosed.

Is this factory already closed?
public Iterator<E>
private SessionImpl
openSession(Connection connection, boolean autoClose, long timestamp, Interceptor sessionLocalInterceptor)

public Session
openSession(Connection
a connection provided by the application.
connection
,
Interceptor
a session-scoped interceptor
sessionLocalInterceptor
)

Implements org.hibernate.SessionFactory.openSession.

Open a Session, utilizing the specfied JDBC Connection and specified Interceptor.
public Session
openSession(Interceptor
a session-scoped interceptor
sessionLocalInterceptor
)

Implements org.hibernate.SessionFactory.openSession.

Open a Session, utilizing the specified Interceptor.
public Session
openSession(Connection
a connection provided by the application.
connection
)

Implements org.hibernate.SessionFactory.openSession.

Open a Session, utilizing the specfied JDBC Connection.
public Session
public Session
openSession(final Connection
The external jdbc connection to use, if one (i.e., optional).
connection
,
final boolean
Should the session be auto-flushed prior to transaction completion?
flushBeforeCompletionEnabled
,
final boolean
Should the session be auto-closed after transaction completion?
autoCloseSessionEnabled
,
final ConnectionReleaseMode
The release mode for managed jdbc connections.
connectionReleaseMode
)

Implements org.hibernate.engine.SessionFactoryImplementor.openSession.

Open a session conforming to the given parameters.
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.SessionFactoryImplementor.openTemporarySession.

Get a nontransactional "current" session for Hibernate EntityManager
private void
private Object
public void
private void
private void
pack-priv void
serialize(ObjectOutputStream
The stream to which to write the factory
oos
)

Custom serialization hook used during Session serialization.

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait