|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hibernate.impl.SessionFactoryImpl
Concrete implementation of the SessionFactory interface. Has the following responsibilites
ConnectionProvider
,
Session
,
QueryTranslator
,
EntityPersister
,
CollectionPersister
,
Serialized FormConstructor Summary | |
SessionFactoryImpl(Configuration cfg,
Mapping mapping,
Settings settings,
SessionEventListenerConfig 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 |
ConnectionProvider |
getConnectionProvider()
Get the connection provider |
Session |
getCurrentSession()
Obtains the current session, where "current" is maintained in relation to the current JTA transaction; if a Session is not already associated with the current JTA transaction, a new Session will be opened and it will be associated with that JTA transaction. |
Dialect |
getDialect()
Get the SQL Dialect |
EntityPersister |
getEntityPersister(String entityName)
Get the persister for the named entity |
FilterTranslator |
getFilter(String filterString,
String collectionRole,
boolean scalar,
Map enabledFilters)
|
FilterDefinition |
getFilterDefinition(String filterName)
|
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 |
NamedQueryDefinition |
getNamedQuery(String queryName)
|
NamedSQLQueryDefinition |
getNamedSQLQuery(String queryName)
|
Type |
getPropertyType(String className,
String propertyName)
|
QueryTranslator[] |
getQuery(String queryString,
boolean shallow,
Map enabledFilters)
|
QueryCache |
getQueryCache()
Get the default query cache |
QueryCache |
getQueryCache(String cacheRegion)
Get a particular named query cache, or the default cache |
Reference |
getReference()
|
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. |
SqlResultsetMappingDefinition |
getSqlResultSetMapping(String resultSetName)
|
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,
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. |
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, SessionEventListenerConfig listeners) throws HibernateException
Method Detail |
public QueryTranslator[] getQuery(String queryString, boolean shallow, Map enabledFilters) throws QueryException, MappingException
QueryException
MappingException
public FilterTranslator getFilter(String filterString, String collectionRole, boolean scalar, Map enabledFilters) throws QueryException, MappingException
QueryException
MappingException
public Session openSession(Connection connection, Interceptor sessionLocalInterceptor)
SessionFactory
Note 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 SessionFactory
connection
- a connection provided by the application.sessionLocalInterceptor
- a session-scoped interceptor
public Session openSession(Interceptor sessionLocalInterceptor) throws HibernateException
SessionFactory
openSession
in interface SessionFactory
sessionLocalInterceptor
- a session-scoped interceptor
HibernateException
public Session openSession(Connection connection)
SessionFactory
Note 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 SessionFactory
connection
- a connection provided by the application.
public Session openSession() throws HibernateException
SessionFactory
openSession
in interface SessionFactory
HibernateException
public Session getCurrentSession() throws HibernateException
SessionFactory
TransactionManager
for the given environment.
A Transaction
must also already be in effect
prior to calls to this method. If either condition fails, an exception
is thrown.
The Sessions returned from this method are automatically configured with
both the auto-flush
and
auto-close
attributes set to
true, meaning that the Session will be automatically flushed and closed
as part of the lifecycle for the JTA transaction to which it is associated.
getCurrentSession
in interface SessionFactory
HibernateException
- Indicates that eitherpublic EntityPersister getEntityPersister(String entityName) throws MappingException
SessionFactoryImplementor
getEntityPersister
in interface SessionFactoryImplementor
MappingException
public CollectionPersister getCollectionPersister(String role) throws MappingException
SessionFactoryImplementor
getCollectionPersister
in interface SessionFactoryImplementor
MappingException
public Settings getSettings()
getSettings
in interface SessionFactoryImplementor
public Dialect getDialect()
SessionFactoryImplementor
getDialect
in interface SessionFactoryImplementor
public TransactionFactory getTransactionFactory()
public TransactionManager getTransactionManager()
SessionFactoryImplementor
getTransactionManager
in interface SessionFactoryImplementor
public SQLExceptionConverter getSQLExceptionConverter()
SessionFactoryImplementor
getSQLExceptionConverter
in interface SessionFactoryImplementor
public Reference getReference() throws NamingException
getReference
in interface Referenceable
NamingException
public NamedQueryDefinition getNamedQuery(String queryName)
getNamedQuery
in interface SessionFactoryImplementor
public NamedSQLQueryDefinition getNamedSQLQuery(String queryName)
getNamedSQLQuery
in interface SessionFactoryImplementor
public SqlResultsetMappingDefinition getSqlResultSetMapping(String resultSetName)
getSqlResultSetMapping
in interface SessionFactoryImplementor
public Type getIdentifierType(String className) throws MappingException
getIdentifierType
in interface Mapping
MappingException
public String getIdentifierPropertyName(String className) throws MappingException
getIdentifierPropertyName
in interface Mapping
MappingException
public Type[] getReturnTypes(String queryString) throws HibernateException
SessionFactoryImplementor
getReturnTypes
in interface SessionFactoryImplementor
HibernateException
public String[] getReturnAliases(String queryString) throws HibernateException
SessionFactoryImplementor
getReturnAliases
in interface SessionFactoryImplementor
HibernateException
public ClassMetadata getClassMetadata(Class persistentClass) throws HibernateException
SessionFactory
getClassMetadata
in interface SessionFactory
HibernateException
ClassMetadata
public CollectionMetadata getCollectionMetadata(String roleName) throws HibernateException
SessionFactory
getCollectionMetadata
in interface SessionFactory
HibernateException
CollectionMetadata
public ClassMetadata getClassMetadata(String entityName) throws HibernateException
SessionFactory
getClassMetadata
in interface SessionFactory
HibernateException
ClassMetadata
public String[] getImplementors(String className) throws MappingException
getImplementors
in interface SessionFactoryImplementor
MappingException
public String getImportedClassName(String className)
SessionFactoryImplementor
getImportedClassName
in interface SessionFactoryImplementor
public Map getAllClassMetadata() throws HibernateException
SessionFactory
getAllClassMetadata
in interface SessionFactory
HibernateException
ClassMetadata
public Map getAllCollectionMetadata() throws HibernateException
SessionFactory
getAllCollectionMetadata
in interface SessionFactory
HibernateException
CollectionMetadata
public void close() throws HibernateException
close
in interface SessionFactory
HibernateException
public void evictEntity(String entityName, Serializable id) throws HibernateException
SessionFactory
evictEntity
in interface SessionFactory
HibernateException
public void evictEntity(String entityName) throws HibernateException
SessionFactory
evictEntity
in interface SessionFactory
HibernateException
public void evict(Class persistentClass, Serializable id) throws HibernateException
SessionFactory
evict
in interface SessionFactory
HibernateException
public void evict(Class persistentClass) throws HibernateException
SessionFactory
evict
in interface SessionFactory
HibernateException
public void evictCollection(String roleName, Serializable id) throws HibernateException
SessionFactory
evictCollection
in interface SessionFactory
HibernateException
public void evictCollection(String roleName) throws HibernateException
SessionFactory
evictCollection
in interface SessionFactory
HibernateException
public Type getPropertyType(String className, String propertyName) throws MappingException
getPropertyType
in interface Mapping
MappingException
public ConnectionProvider getConnectionProvider()
SessionFactoryImplementor
getConnectionProvider
in interface SessionFactoryImplementor
public UpdateTimestampsCache getUpdateTimestampsCache()
SessionFactoryImplementor
getUpdateTimestampsCache
in interface SessionFactoryImplementor
public QueryCache getQueryCache()
SessionFactoryImplementor
getQueryCache
in interface SessionFactoryImplementor
public QueryCache getQueryCache(String cacheRegion) throws HibernateException
SessionFactoryImplementor
getQueryCache
in interface SessionFactoryImplementor
cacheRegion
- the name of the cache region, or null for the default query cache
HibernateException
public Cache getSecondLevelCacheRegion(String regionName)
SessionFactoryImplementor
getSecondLevelCacheRegion
in interface SessionFactoryImplementor
public Map getAllSecondLevelCacheRegions()
getAllSecondLevelCacheRegions
in interface SessionFactoryImplementor
public boolean isClosed()
SessionFactory
isClosed
in interface SessionFactory
public Statistics getStatistics()
SessionFactory
getStatistics
in interface SessionFactory
public StatisticsImplementor getStatisticsImplementor()
SessionFactoryImplementor
getStatisticsImplementor
in interface SessionFactoryImplementor
public void evictQueries() throws HibernateException
SessionFactory
evictQueries
in interface SessionFactory
HibernateException
public void evictQueries(String cacheRegion) throws HibernateException
SessionFactory
evictQueries
in interface SessionFactory
HibernateException
public FilterDefinition getFilterDefinition(String filterName) throws IllegalArgumentException
IllegalArgumentException
public BatcherFactory getBatcherFactory()
public IdentifierGenerator getIdentifierGenerator(String rootEntityName)
SessionFactoryImplementor
getIdentifierGenerator
in interface SessionFactoryImplementor
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |