public final class SessionFactoryImpl extends Object implements SessionFactoryImplementor
ConnectionProvider,
Session,
QueryTranslator,
EntityPersister,
CollectionPersister,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
SessionFactoryImpl.StatelessSessionBuilderImpl |
SessionFactoryImplementor.DeserializationResolver<T extends SessionFactoryImplementor>| Constructor and Description |
|---|
SessionFactoryImpl(MetadataImplementor metadata,
SessionFactoryOptions options) |
| Modifier and Type | Method and Description |
|---|---|
void |
addObserver(SessionFactoryObserver observer) |
void |
close()
Closes the session factory, releasing all held resources.
|
boolean |
containsFetchProfileDefinition(String name)
Determine if this session factory contains a fetch profile definition
registered under the given name.
|
void |
evict(Class persistentClass) |
void |
evict(Class persistentClass,
Serializable id) |
void |
evictCollection(String roleName) |
void |
evictCollection(String roleName,
Serializable id) |
void |
evictEntity(String entityName) |
void |
evictEntity(String entityName,
Serializable id) |
void |
evictQueries() |
void |
evictQueries(String regionName) |
Map<String,ClassMetadata> |
getAllClassMetadata()
Retrieve the
ClassMetadata for all mapped entities. |
Map |
getAllCollectionMetadata()
Get the
CollectionMetadata for all mapped collections. |
Map |
getAllSecondLevelCacheRegions()
Get a map of all the second level cache regions currently maintained in
this session factory.
|
Cache |
getCache()
Obtain direct access to the underlying cache regions.
|
ClassMetadata |
getClassMetadata(Class persistentClass)
Retrieve the
ClassMetadata associated with the given entity class. |
ClassMetadata |
getClassMetadata(String entityName)
Retrieve the
ClassMetadata associated with the given entity class. |
CollectionMetadata |
getCollectionMetadata(String roleName)
Get the
CollectionMetadata associated with the named collection role. |
CollectionPersister |
getCollectionPersister(String role)
Get the persister object for a collection role.
|
Map<String,CollectionPersister> |
getCollectionPersisters()
Get all collection persisters as a Map, which collection role as the key and the persister is the value.
|
Set<String> |
getCollectionRolesByEntityParticipant(String entityName)
Retrieves a set of all the collection roles in which the given entity
is a participant, as either an index or an element.
|
Session |
getCurrentSession()
Obtains the current session.
|
CurrentTenantIdentifierResolver |
getCurrentTenantIdentifierResolver() |
CustomEntityDirtinessStrategy |
getCustomEntityDirtinessStrategy() |
Set |
getDefinedFilterNames()
Obtain a set of the names of all filters defined on this SessionFactory.
|
SessionFactoryImplementor.DeserializationResolver |
getDeserializationResolver() |
Dialect |
getDialect()
Get the SQL dialect.
|
EntityNotFoundDelegate |
getEntityNotFoundDelegate() |
EntityPersister |
getEntityPersister(String entityName)
Get the persister for the named entity
|
Map<String,EntityPersister> |
getEntityPersisters()
Get all entity persisters as a Map, which entity name its the key and the persister is the value.
|
FetchProfile |
getFetchProfile(String name)
Retrieve fetch profile by name.
|
FilterDefinition |
getFilterDefinition(String filterName)
Obtain the definition of a filter by name.
|
IdentifierGenerator |
getIdentifierGenerator(String rootEntityName)
Get the identifier generator for the hierarchy
|
IdentifierGeneratorFactory |
getIdentifierGeneratorFactory()
Allow access to the id generator factory, though this is only needed/allowed from configuration.
|
String |
getIdentifierPropertyName(String className) |
Type |
getIdentifierType(String className) |
String[] |
getImplementors(String className)
Given the name of an entity class, determine all the class and interface names by which it can be
referenced in an HQL query.
|
String |
getImportedClassName(String className)
Get a class name, using query language imports
|
Interceptor |
getInterceptor()
Get the factory scoped interceptor for this factory.
|
JdbcServices |
getJdbcServices()
Get the JdbcServices.
|
NamedQueryDefinition |
getNamedQuery(String queryName) |
NamedQueryRepository |
getNamedQueryRepository()
Provides access to the named query repository
|
NamedSQLQueryDefinition |
getNamedSQLQuery(String queryName) |
Region |
getNaturalIdCacheRegion(String regionName)
Get a named naturalId cache region
|
RegionAccessStrategy |
getNaturalIdCacheRegionAccessStrategy(String regionName)
Get access strategy to naturalId cache region
|
Properties |
getProperties()
Get a copy of the Properties used to configure this session factory.
|
QueryCache |
getQueryCache()
Get the default query cache
|
QueryCache |
getQueryCache(String regionName)
Get a particular named query cache, or the default cache
|
QueryPlanCache |
getQueryPlanCache() |
Reference |
getReference() |
Type |
getReferencedPropertyType(String className,
String propertyName) |
ResultSetMappingDefinition |
getResultSetMapping(String mappingName) |
String[] |
getReturnAliases(String queryString)
Get the return aliases of a query
|
Type[] |
getReturnTypes(String queryString)
Get the return types of a query
|
Region |
getSecondLevelCacheRegion(String regionName)
Get a named second-level cache region
|
RegionAccessStrategy |
getSecondLevelCacheRegionAccessStrategy(String regionName)
Get access strategy to second-level cache region
|
ServiceRegistryImplementor |
getServiceRegistry() |
SessionFactoryOptions |
getSessionFactoryOptions()
Get the special options used to build the factory.
|
Settings |
getSettings() |
SQLExceptionConverter |
getSQLExceptionConverter()
Retrieves the SQLExceptionConverter in effect for this SessionFactory.
|
SqlExceptionHelper |
getSQLExceptionHelper()
Retrieves the SqlExceptionHelper in effect for this SessionFactory.
|
SQLFunctionRegistry |
getSqlFunctionRegistry() |
Statistics |
getStatistics()
Retrieve the statistics fopr this factory.
|
StatisticsImplementor |
getStatisticsImplementor()
Statistics SPI
|
TypeHelper |
getTypeHelper()
Retrieve this factory's
TypeHelper. |
TypeResolver |
getTypeResolver()
Retrieve the
Type resolver associated with this factory. |
UpdateTimestampsCache |
getUpdateTimestampsCache()
Get the cache of table update timestamps
|
String |
getUuid()
Get the UUID for this SessionFactory.
|
boolean |
isClosed()
Is this factory already closed?
|
Iterable<EntityNameResolver> |
iterateEntityNameResolvers() |
EntityPersister |
locateEntityPersister(Class byClass)
Locate an EntityPersister by the entity class.
|
EntityPersister |
locateEntityPersister(String byName)
Locate the entity persister by name.
|
Session |
openSession()
Open a
Session. |
StatelessSession |
openStatelessSession()
Open a new stateless session.
|
StatelessSession |
openStatelessSession(Connection connection)
Open a new stateless session, utilizing the specified JDBC
Connection. |
Session |
openTemporarySession()
Get a non-transactional "current" session for Hibernate EntityManager
|
void |
registerEntityNameResolver(EntityNameResolver resolver) |
void |
registerNamedQueryDefinition(String name,
NamedQueryDefinition definition) |
void |
registerNamedSQLQueryDefinition(String name,
NamedSQLQueryDefinition definition) |
SessionBuilderImplementor |
withOptions()
Obtain a
Session builder. |
StatelessSessionBuilder |
withStatelessOptions()
Obtain a
StatelessSession builder. |
public SessionFactoryImpl(MetadataImplementor metadata, SessionFactoryOptions options)
public Session openSession() throws HibernateException
SessionFactorySession.
JDBC connection(s will be obtained from the
configured ConnectionProvider as needed
to perform requested work.openSession in interface SessionFactoryHibernateException - Indicates a problem opening the session; pretty rare here.public Session openTemporarySession() throws HibernateException
SessionFactoryImplementoropenTemporarySession in interface SessionFactoryImplementorHibernateExceptionpublic Session getCurrentSession() throws HibernateException
SessionFactoryCurrentSessionContext impl configured
for use.
Note that for backwards compatibility, if a CurrentSessionContext
is not configured but JTA is configured this will default to the JTASessionContext
impl.getCurrentSession in interface SessionFactoryHibernateException - Indicates an issue locating a suitable current session.public SessionBuilderImplementor withOptions()
SessionFactorySession builder.withOptions in interface SessionFactoryImplementorwithOptions in interface SessionFactorypublic StatelessSessionBuilder withStatelessOptions()
SessionFactoryStatelessSession builder.withStatelessOptions in interface SessionFactorypublic StatelessSession openStatelessSession()
SessionFactoryopenStatelessSession in interface SessionFactorypublic StatelessSession openStatelessSession(Connection connection)
SessionFactoryConnection.openStatelessSession in interface SessionFactoryconnection - Connection provided by the application.public void addObserver(SessionFactoryObserver observer)
addObserver in interface SessionFactoryImplementorpublic Properties getProperties()
SessionFactoryImplementorgetProperties in interface SessionFactoryImplementorpublic String getUuid()
SessionFactoryImplementorUUID, but kept
as a String.getUuid in interface SessionFactoryImplementorSessionFactoryRegistry.getSessionFactory(java.lang.String)public IdentifierGeneratorFactory getIdentifierGeneratorFactory()
MappinggetIdentifierGeneratorFactory in interface Mappingpublic TypeResolver getTypeResolver()
SessionFactoryImplementorType resolver associated with this factory.getTypeResolver in interface SessionFactoryImplementorpublic void registerEntityNameResolver(EntityNameResolver resolver)
public Iterable<EntityNameResolver> iterateEntityNameResolvers()
iterateEntityNameResolvers in interface SessionFactoryImplementorpublic QueryPlanCache getQueryPlanCache()
getQueryPlanCache in interface SessionFactoryImplementorpublic Map<String,EntityPersister> getEntityPersisters()
SessionFactoryImplementorgetEntityPersisters in interface SessionFactoryImplementorpublic EntityPersister getEntityPersister(String entityName) throws MappingException
SessionFactoryImplementorgetEntityPersister in interface SessionFactoryImplementorentityName - The name of the entity for which to retrieve the persister.MappingException - Indicates persister could not be found with that name.public EntityPersister locateEntityPersister(Class byClass)
SessionFactoryImplementorlocateEntityPersister in interface SessionFactoryImplementorbyClass - The concrete Class or proxy interface for the entity to locate the persister for.nullpublic EntityPersister locateEntityPersister(String byName)
SessionFactoryImplementorlocateEntityPersister in interface SessionFactoryImplementorbyName - The entity namenullpublic SessionFactoryImplementor.DeserializationResolver getDeserializationResolver()
getDeserializationResolver in interface SessionFactoryImplementorpublic Map<String,CollectionPersister> getCollectionPersisters()
SessionFactoryImplementorgetCollectionPersisters in interface SessionFactoryImplementorpublic CollectionPersister getCollectionPersister(String role) throws MappingException
SessionFactoryImplementorgetCollectionPersister in interface SessionFactoryImplementorrole - The role (name) of the collection for which to retrieve the
persister.MappingException - Indicates persister could not be found with that role.public Settings getSettings()
getSettings in interface SessionFactoryImplementorpublic SessionFactoryOptions getSessionFactoryOptions()
SessionFactorygetSessionFactoryOptions in interface SessionFactorypublic JdbcServices getJdbcServices()
SessionFactoryImplementorgetJdbcServices in interface SessionFactoryImplementorpublic Dialect getDialect()
SessionFactoryImplementorgetJdbcServices().getDialect()getDialect in interface SessionFactoryImplementorpublic Interceptor getInterceptor()
SessionFactoryImplementorgetInterceptor in interface SessionFactoryImplementorpublic SQLExceptionConverter getSQLExceptionConverter()
SessionFactoryImplementorgetSQLExceptionConverter in interface SessionFactoryImplementorpublic SqlExceptionHelper getSQLExceptionHelper()
SessionFactoryImplementorgetSQLExceptionHelper in interface SessionFactoryImplementorpublic Set<String> getCollectionRolesByEntityParticipant(String entityName)
SessionFactoryImplementorgetCollectionRolesByEntityParticipant in interface SessionFactoryImplementorentityName - The entity name for which to get the collection roles.public Reference getReference()
getReference in interface Referenceablepublic NamedQueryRepository getNamedQueryRepository()
SessionFactoryImplementorgetNamedQueryRepository in interface SessionFactoryImplementorpublic void registerNamedQueryDefinition(String name, NamedQueryDefinition definition)
registerNamedQueryDefinition in interface SessionFactoryImplementorpublic NamedQueryDefinition getNamedQuery(String queryName)
getNamedQuery in interface SessionFactoryImplementorpublic void registerNamedSQLQueryDefinition(String name, NamedSQLQueryDefinition definition)
registerNamedSQLQueryDefinition in interface SessionFactoryImplementorpublic NamedSQLQueryDefinition getNamedSQLQuery(String queryName)
getNamedSQLQuery in interface SessionFactoryImplementorpublic ResultSetMappingDefinition getResultSetMapping(String mappingName)
getResultSetMapping in interface SessionFactoryImplementorpublic Type getIdentifierType(String className) throws MappingException
getIdentifierType in interface MappingMappingExceptionpublic String getIdentifierPropertyName(String className) throws MappingException
getIdentifierPropertyName in interface MappingMappingExceptionpublic Type[] getReturnTypes(String queryString) throws HibernateException
SessionFactoryImplementorgetReturnTypes in interface SessionFactoryImplementorHibernateExceptionpublic String[] getReturnAliases(String queryString) throws HibernateException
SessionFactoryImplementorgetReturnAliases in interface SessionFactoryImplementorHibernateExceptionpublic ClassMetadata getClassMetadata(Class persistentClass) throws HibernateException
SessionFactoryClassMetadata associated with the given entity class.getClassMetadata in interface SessionFactorypersistentClass - The entity classHibernateException - Generally null is returned instead of throwing.public CollectionMetadata getCollectionMetadata(String roleName) throws HibernateException
SessionFactoryCollectionMetadata associated with the named collection role.getCollectionMetadata in interface SessionFactoryroleName - The collection role (in form [owning-entity-name].[collection-property-name]).HibernateException - Generally null is returned instead of throwing.public ClassMetadata getClassMetadata(String entityName) throws HibernateException
SessionFactoryClassMetadata associated with the given entity class.getClassMetadata in interface SessionFactoryentityName - The entity classHibernateException - Generally null is returned instead of throwing.public String[] getImplementors(String className) throws MappingException
getImplementors in interface SessionFactoryImplementorclassName - The name of the entity classMappingExceptionpublic String getImportedClassName(String className)
SessionFactoryImplementorgetImportedClassName in interface SessionFactoryImplementorpublic Map<String,ClassMetadata> getAllClassMetadata() throws HibernateException
SessionFactoryClassMetadata for all mapped entities.getAllClassMetadata in interface SessionFactoryClassMetadata keyed by the
corresponding String entity-name.HibernateException - Generally empty map is returned instead of throwing.public Map getAllCollectionMetadata() throws HibernateException
SessionFactoryCollectionMetadata for all mapped collections.getAllCollectionMetadata in interface SessionFactoryHibernateException - Generally empty map is returned instead of throwing.public Type getReferencedPropertyType(String className, String propertyName) throws MappingException
getReferencedPropertyType in interface MappingMappingExceptionpublic void close()
throws HibernateException
close in interface Closeableclose in interface AutoCloseableclose in interface SessionFactoryHibernateExceptionpublic Cache getCache()
SessionFactorygetCache in interface SessionFactorypublic void evictEntity(String entityName, Serializable id) throws HibernateException
HibernateExceptionpublic void evictEntity(String entityName) throws HibernateException
HibernateExceptionpublic void evict(Class persistentClass, Serializable id) throws HibernateException
HibernateExceptionpublic void evict(Class persistentClass) throws HibernateException
HibernateExceptionpublic void evictCollection(String roleName, Serializable id) throws HibernateException
HibernateExceptionpublic void evictCollection(String roleName) throws HibernateException
HibernateExceptionpublic void evictQueries()
throws HibernateException
HibernateExceptionpublic void evictQueries(String regionName) throws HibernateException
HibernateExceptionpublic UpdateTimestampsCache getUpdateTimestampsCache()
SessionFactoryImplementorgetUpdateTimestampsCache in interface SessionFactoryImplementorpublic QueryCache getQueryCache()
SessionFactoryImplementorgetQueryCache in interface SessionFactoryImplementorpublic QueryCache getQueryCache(String regionName) throws HibernateException
SessionFactoryImplementorgetQueryCache in interface SessionFactoryImplementorregionName - the name of the cache region, or null for the default query cacheHibernateExceptionpublic Region getSecondLevelCacheRegion(String regionName)
SessionFactoryImplementorgetSecondLevelCacheRegion in interface SessionFactoryImplementorregionName - The name of the region to retrieve.public RegionAccessStrategy getSecondLevelCacheRegionAccessStrategy(String regionName)
SessionFactoryImplementorgetSecondLevelCacheRegionAccessStrategy in interface SessionFactoryImplementorpublic Region getNaturalIdCacheRegion(String regionName)
SessionFactoryImplementorgetNaturalIdCacheRegion in interface SessionFactoryImplementorregionName - The name of the region to retrieve.public RegionAccessStrategy getNaturalIdCacheRegionAccessStrategy(String regionName)
SessionFactoryImplementorgetNaturalIdCacheRegionAccessStrategy in interface SessionFactoryImplementorpublic Map getAllSecondLevelCacheRegions()
SessionFactoryImplementorRegion instances as the values.getAllSecondLevelCacheRegions in interface SessionFactoryImplementorpublic boolean isClosed()
SessionFactoryisClosed in interface SessionFactorypublic Statistics getStatistics()
SessionFactorygetStatistics in interface SessionFactorypublic StatisticsImplementor getStatisticsImplementor()
SessionFactoryImplementorgetStatisticsImplementor in interface SessionFactoryImplementorpublic FilterDefinition getFilterDefinition(String filterName) throws HibernateException
SessionFactorygetFilterDefinition in interface SessionFactoryfilterName - The name of the filter for which to obtain the definition.HibernateException - If no filter defined with the given name.public boolean containsFetchProfileDefinition(String name)
SessionFactorycontainsFetchProfileDefinition in interface SessionFactoryname - The name to checkpublic Set getDefinedFilterNames()
SessionFactorygetDefinedFilterNames in interface SessionFactorypublic IdentifierGenerator getIdentifierGenerator(String rootEntityName)
SessionFactoryImplementorgetIdentifierGenerator in interface SessionFactoryImplementorpublic ServiceRegistryImplementor getServiceRegistry()
getServiceRegistry in interface SessionFactoryImplementorpublic EntityNotFoundDelegate getEntityNotFoundDelegate()
getEntityNotFoundDelegate in interface SessionFactoryImplementorpublic SQLFunctionRegistry getSqlFunctionRegistry()
getSqlFunctionRegistry in interface SessionFactoryImplementorpublic FetchProfile getFetchProfile(String name)
SessionFactoryImplementorgetFetchProfile in interface SessionFactoryImplementorname - The name of the profile to retrieve.public TypeHelper getTypeHelper()
SessionFactoryTypeHelper.getTypeHelper in interface SessionFactoryTypeHelperpublic CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy()
getCustomEntityDirtinessStrategy in interface SessionFactoryImplementorpublic CurrentTenantIdentifierResolver getCurrentTenantIdentifierResolver()
getCurrentTenantIdentifierResolver in interface SessionFactoryImplementorCopyright © 2017 JBoss by Red Hat. All rights reserved.