|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hibernate.impl.SessionFactoryImpl
public final class SessionFactoryImpl
Concrete implementation of the SessionFactory interface. Has the following responsibilites
ConnectionProvider,
Session,
QueryTranslator,
EntityPersister,
CollectionPersister,
Serialized Form| Constructor Summary | |
|---|---|
SessionFactoryImpl(Configuration cfg,
Mapping mapping,
Settings settings,
EventListeners listeners)
|
|
| Method Summary | |
|---|---|
void |
close()
Closes the session factory, releasing all held resources. |
void |
evict(Class persistentClass)
Evict all entries from the second-level cache. |
void |
evict(Class persistentClass,
Serializable id)
Evict an entry from the second-level cache. |
void |
evictCollection(String roleName)
Evict all entries from the second-level cache. |
void |
evictCollection(String roleName,
Serializable id)
Evict an entry from the second-level cache. |
void |
evictEntity(String entityName)
Evict all entries from the second-level cache. |
void |
evictEntity(String entityName,
Serializable id)
Evict an entry from the second-level cache. |
void |
evictQueries()
Evict any query result sets cached in the default query cache region. |
void |
evictQueries(String cacheRegion)
Evict any query result sets cached in the named query cache region. |
Map |
getAllClassMetadata()
Get all ClassMetadata as a Map from entityname String to metadata object |
Map |
getAllCollectionMetadata()
Get all CollectionMetadata as a Map from role name to metadata object |
Map |
getAllSecondLevelCacheRegions()
|
BatcherFactory |
getBatcherFactory()
|
ClassMetadata |
getClassMetadata(Class persistentClass)
Get the ClassMetadata associated with the given entity class |
ClassMetadata |
getClassMetadata(String entityName)
Get the ClassMetadata associated with the given entity name |
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 |
Set |
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. |
ConnectionProvider |
getConnectionProvider()
Get the connection provider |
Session |
getCurrentSession()
Obtains the current session. |
Set |
getDefinedFilterNames()
Obtain a set of the names of all filters defined on this SessionFactory. |
Dialect |
getDialect()
Get the SQL Dialect |
EntityNotFoundDelegate |
getEntityNotFoundDelegate()
|
EntityPersister |
getEntityPersister(String entityName)
Get the persister for the named entity |
EventListeners |
getEventListeners()
|
FilterDefinition |
getFilterDefinition(String filterName)
Obtain the definition of a filter by name. |
IdentifierGenerator |
getIdentifierGenerator(String rootEntityName)
Get the identifier generator for the hierarchy |
String |
getIdentifierPropertyName(String className)
|
Type |
getIdentifierType(String className)
|
String[] |
getImplementors(String className)
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. |
String |
getImportedClassName(String className)
Get a class name, using query language imports |
Interceptor |
getInterceptor()
|
NamedQueryDefinition |
getNamedQuery(String queryName)
|
NamedSQLQueryDefinition |
getNamedSQLQuery(String queryName)
|
QueryCache |
getQueryCache()
Get the default query cache |
QueryCache |
getQueryCache(String cacheRegion)
Get a particular named query cache, or the default cache |
QueryPlanCache |
getQueryPlanCache()
|
Reference |
getReference()
|
Type |
getReferencedPropertyType(String className,
String propertyName)
|
ResultSetMappingDefinition |
getResultSetMapping(String resultSetName)
|
String[] |
getReturnAliases(String queryString)
Get the return aliases of a query |
Type[] |
getReturnTypes(String queryString)
Get the return types of a query |
Cache |
getSecondLevelCacheRegion(String regionName)
Get a named second-level cache region |
Settings |
getSettings()
|
SQLExceptionConverter |
getSQLExceptionConverter()
Retrieves the SQLExceptionConverter in effect for this SessionFactory. |
SQLFunctionRegistry |
getSqlFunctionRegistry()
|
Statistics |
getStatistics()
Get the statistics for this session factory |
StatisticsImplementor |
getStatisticsImplementor()
Statistics SPI |
TransactionFactory |
getTransactionFactory()
|
TransactionManager |
getTransactionManager()
Get the JTA transaction manager |
UpdateTimestampsCache |
getUpdateTimestampsCache()
Get the cache of table update timestamps |
boolean |
isClosed()
Was this SessionFactory already closed? |
Session |
openSession()
Create database connection and open a Session on it. |
Session |
openSession(Connection connection)
Open a Session on the given connection. |
Session |
openSession(Connection connection,
boolean flushBeforeCompletionEnabled,
boolean autoCloseSessionEnabled,
ConnectionReleaseMode connectionReleaseMode)
Open a session conforming to the given parameters. |
Session |
openSession(Connection connection,
Interceptor sessionLocalInterceptor)
Open a Session on the given connection, specifying an interceptor. |
Session |
openSession(Interceptor sessionLocalInterceptor)
Create database connection and open a Session on it, specifying an interceptor. |
StatelessSession |
openStatelessSession()
Get a new stateless session. |
StatelessSession |
openStatelessSession(Connection connection)
Get a new stateless session for the given JDBC connection. |
Session |
openTemporarySession()
Get a nontransactional "current" session for Hibernate EntityManager |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SessionFactoryImpl(Configuration cfg,
Mapping mapping,
Settings settings,
EventListeners listeners)
throws HibernateException
HibernateException| Method Detail |
|---|
public QueryPlanCache getQueryPlanCache()
getQueryPlanCache in interface SessionFactoryImplementorpublic StatelessSession openStatelessSession()
SessionFactory
openStatelessSession in interface SessionFactorypublic StatelessSession openStatelessSession(Connection connection)
SessionFactory
openStatelessSession in interface SessionFactory
public Session openSession(Connection connection,
Interceptor sessionLocalInterceptor)
SessionFactoryNote that the second-level cache will be disabled if you supply a JDBC connection. Hibernate will not be able to track any statements you might have executed in the same transaction. Consider implementing your own ConnectionProvider.
openSession in interface SessionFactoryconnection - a connection provided by the application.sessionLocalInterceptor - a session-scoped interceptor
public Session openSession(Interceptor sessionLocalInterceptor)
throws HibernateException
SessionFactory
openSession in interface SessionFactorysessionLocalInterceptor - a session-scoped interceptor
HibernateExceptionpublic Session openSession(Connection connection)
SessionFactoryNote that the second-level cache will be disabled if you supply a JDBC connection. Hibernate will not be able to track any statements you might have executed in the same transaction. Consider implementing your own ConnectionProvider.
openSession in interface SessionFactoryconnection - a connection provided by the application.
public Session openSession()
throws HibernateException
SessionFactory
openSession in interface SessionFactoryHibernateException
public Session openTemporarySession()
throws HibernateException
SessionFactoryImplementor
openTemporarySession in interface SessionFactoryImplementorHibernateException
public Session openSession(Connection connection,
boolean flushBeforeCompletionEnabled,
boolean autoCloseSessionEnabled,
ConnectionReleaseMode connectionReleaseMode)
throws HibernateException
SessionFactoryImplementorJTASessionContext for current session processing.
openSession in interface SessionFactoryImplementorconnection - The external jdbc connection to use, if one (i.e., optional).flushBeforeCompletionEnabled - Should the session be auto-flushed
prior to transaction completion?autoCloseSessionEnabled - Should the session be auto-closed after
transaction completion?connectionReleaseMode - The release mode for managed jdbc connections.
HibernateException
public Session getCurrentSession()
throws HibernateException
SessionFactoryCurrentSessionContext impl configured
for use.
Note that for backwards compatibility, if a CurrentSessionContext
is not configured but a JTA TransactionManagerLookup
is configured this will default to the JTASessionContext
impl.
getCurrentSession in interface SessionFactoryHibernateException - Indicates an issue locating a suitable current session.
public EntityPersister getEntityPersister(String entityName)
throws MappingException
SessionFactoryImplementor
getEntityPersister in interface SessionFactoryImplementorMappingException
public CollectionPersister getCollectionPersister(String role)
throws MappingException
SessionFactoryImplementor
getCollectionPersister in interface SessionFactoryImplementorMappingExceptionpublic Settings getSettings()
getSettings in interface SessionFactoryImplementorpublic Dialect getDialect()
SessionFactoryImplementor
getDialect in interface SessionFactoryImplementorpublic Interceptor getInterceptor()
getInterceptor in interface SessionFactoryImplementorpublic TransactionFactory getTransactionFactory()
public TransactionManager getTransactionManager()
SessionFactoryImplementor
getTransactionManager in interface SessionFactoryImplementorpublic SQLExceptionConverter getSQLExceptionConverter()
SessionFactoryImplementor
getSQLExceptionConverter in interface SessionFactoryImplementorpublic Set getCollectionRolesByEntityParticipant(String entityName)
SessionFactoryImplementor
getCollectionRolesByEntityParticipant in interface SessionFactoryImplementorentityName - The entity name for which to get the collection roles.
public Reference getReference()
throws NamingException
getReference in interface ReferenceableNamingExceptionpublic NamedQueryDefinition getNamedQuery(String queryName)
getNamedQuery in interface SessionFactoryImplementorpublic NamedSQLQueryDefinition getNamedSQLQuery(String queryName)
getNamedSQLQuery in interface SessionFactoryImplementorpublic ResultSetMappingDefinition getResultSetMapping(String resultSetName)
getResultSetMapping in interface SessionFactoryImplementor
public Type getIdentifierType(String className)
throws MappingException
getIdentifierType in interface MappingMappingException
public String getIdentifierPropertyName(String className)
throws MappingException
getIdentifierPropertyName in interface MappingMappingException
public Type[] getReturnTypes(String queryString)
throws HibernateException
SessionFactoryImplementor
getReturnTypes in interface SessionFactoryImplementorHibernateException
public String[] getReturnAliases(String queryString)
throws HibernateException
SessionFactoryImplementor
getReturnAliases in interface SessionFactoryImplementorHibernateException
public ClassMetadata getClassMetadata(Class persistentClass)
throws HibernateException
SessionFactory
getClassMetadata in interface SessionFactoryHibernateExceptionClassMetadata
public CollectionMetadata getCollectionMetadata(String roleName)
throws HibernateException
SessionFactory
getCollectionMetadata in interface SessionFactoryHibernateExceptionCollectionMetadata
public ClassMetadata getClassMetadata(String entityName)
throws HibernateException
SessionFactory
getClassMetadata in interface SessionFactoryHibernateExceptionClassMetadata
public String[] getImplementors(String className)
throws MappingException
getImplementors in interface SessionFactoryImplementorMappingExceptionpublic String getImportedClassName(String className)
SessionFactoryImplementor
getImportedClassName in interface SessionFactoryImplementor
public Map getAllClassMetadata()
throws HibernateException
SessionFactory
getAllClassMetadata in interface SessionFactoryHibernateExceptionClassMetadata
public Map getAllCollectionMetadata()
throws HibernateException
SessionFactory
getAllCollectionMetadata in interface SessionFactoryHibernateExceptionCollectionMetadata
public void close()
throws HibernateException
close in interface SessionFactoryHibernateException
public void evictEntity(String entityName,
Serializable id)
throws HibernateException
SessionFactory
evictEntity in interface SessionFactoryHibernateException
public void evictEntity(String entityName)
throws HibernateException
SessionFactory
evictEntity in interface SessionFactoryHibernateException
public void evict(Class persistentClass,
Serializable id)
throws HibernateException
SessionFactory
evict in interface SessionFactoryHibernateException
public void evict(Class persistentClass)
throws HibernateException
SessionFactory
evict in interface SessionFactoryHibernateException
public void evictCollection(String roleName,
Serializable id)
throws HibernateException
SessionFactory
evictCollection in interface SessionFactoryHibernateException
public void evictCollection(String roleName)
throws HibernateException
SessionFactory
evictCollection in interface SessionFactoryHibernateException
public Type getReferencedPropertyType(String className,
String propertyName)
throws MappingException
getReferencedPropertyType in interface MappingMappingExceptionpublic ConnectionProvider getConnectionProvider()
SessionFactoryImplementor
getConnectionProvider in interface SessionFactoryImplementorpublic UpdateTimestampsCache getUpdateTimestampsCache()
SessionFactoryImplementor
getUpdateTimestampsCache in interface SessionFactoryImplementorpublic QueryCache getQueryCache()
SessionFactoryImplementor
getQueryCache in interface SessionFactoryImplementor
public QueryCache getQueryCache(String cacheRegion)
throws HibernateException
SessionFactoryImplementor
getQueryCache in interface SessionFactoryImplementorcacheRegion - the name of the cache region, or null for the default query cache
HibernateExceptionpublic Cache getSecondLevelCacheRegion(String regionName)
SessionFactoryImplementor
getSecondLevelCacheRegion in interface SessionFactoryImplementorpublic Map getAllSecondLevelCacheRegions()
getAllSecondLevelCacheRegions in interface SessionFactoryImplementorpublic boolean isClosed()
SessionFactory
isClosed in interface SessionFactorypublic Statistics getStatistics()
SessionFactory
getStatistics in interface SessionFactorypublic StatisticsImplementor getStatisticsImplementor()
SessionFactoryImplementor
getStatisticsImplementor in interface SessionFactoryImplementor
public void evictQueries()
throws HibernateException
SessionFactory
evictQueries in interface SessionFactoryHibernateException
public void evictQueries(String cacheRegion)
throws HibernateException
SessionFactory
evictQueries in interface SessionFactoryHibernateException
public FilterDefinition getFilterDefinition(String filterName)
throws HibernateException
SessionFactory
getFilterDefinition in interface SessionFactoryfilterName - The name of the filter for which to obtain the definition.
HibernateException - If no filter defined with the given name.public Set getDefinedFilterNames()
SessionFactory
getDefinedFilterNames in interface SessionFactorypublic BatcherFactory getBatcherFactory()
public IdentifierGenerator getIdentifierGenerator(String rootEntityName)
SessionFactoryImplementor
getIdentifierGenerator in interface SessionFactoryImplementorpublic EventListeners getEventListeners()
public EntityNotFoundDelegate getEntityNotFoundDelegate()
getEntityNotFoundDelegate in interface SessionFactoryImplementorpublic SQLFunctionRegistry getSqlFunctionRegistry()
getSqlFunctionRegistry in interface SessionFactoryImplementor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||