Package org.hibernate.jmx
Class SessionFactoryStub
java.lang.Object
org.hibernate.jmx.SessionFactoryStub
- All Implemented Interfaces:
Serializable,Referenceable,SessionFactory
A flyweight for SessionFactory. If the MBean itself does not
have classpath to the persistent classes, then a stub will be registered
with JNDI and the actual SessionFactoryImpl built upon first
access.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Destroy this SessionFactory and release all resources (caches, connection pools, etc).booleanDetermine if this session factory contains a fetch profile definition registered under the given name.voidEvict all entries from the second-level cache.voidevict(Class persistentClass, Serializable id) Evict an entry from the second-level cache.voidevictCollection(String roleName) Evict all entries from the second-level cache.voidevictCollection(String roleName, Serializable id) Evict an entry from the second-level cache.voidevictEntity(String entityName) Evict all entries from the second-level cache.voidevictEntity(String entityName, Serializable id) Evict an entry from the second-level cache.voidEvict any query result sets cached in the default query cache region.voidevictQueries(String cacheRegion) Evict any query result sets cached in the named query cache region.Retrieve theClassMetadatafor all mapped entities.Get theCollectionMetadatafor all mapped collectionsgetCache()Obtain direct access to the underlying cache regions.getClassMetadata(Class persistentClass) Retrieve theClassMetadataassociated with the given entity class.getClassMetadata(String entityName) Retrieve theClassMetadataassociated with the given entity class.getCollectionMetadata(String roleName) Get theCollectionMetadataassociated with the named collection role.Obtains the current session.Obtain a set of the names of all filters defined on this SessionFactory.getFilterDefinition(String filterName) Obtain the definition of a filter by name.Retrieve the statistics fopr this factory.Retrieve this factory'sTypeHelperbooleanisClosed()Is this factory already closed?Open aSession.openSession(Connection conn) Open aSession, utilizing the specfied JDBCConnection.openSession(Connection connection, Interceptor interceptor) openSession(Interceptor interceptor) Open aSession, utilizing the specifiedInterceptor.Open a new stateless session.Open a new stateless session, utilizing the specified JDBCConnection.
-
Method Details
-
openSession
Description copied from interface:SessionFactoryOpen aSession, utilizing the specfied JDBCConnectionand specifiedInterceptor.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
ConnectionProviderinstead as a highly recommended alternative.- Specified by:
openSessionin interfaceSessionFactory- Parameters:
connection- a connection provided by the application.interceptor- a session-scoped interceptor- Returns:
- The created session.
-
openSession
Description copied from interface:SessionFactoryOpen aSession, utilizing the specifiedInterceptor. JDBCconnection(swill be obtained from the configuredConnectionProvideras needed to perform requested work.- Specified by:
openSessionin interfaceSessionFactory- Parameters:
interceptor- a session-scoped interceptor- Returns:
- The created session.
- Throws:
HibernateException- Indicates a peroblem opening the session; pretty rare here.
-
openSession
Description copied from interface:SessionFactoryOpen aSession. JDBCconnection(swill be obtained from the configuredConnectionProvideras needed to perform requested work.- Specified by:
openSessionin interfaceSessionFactory- Returns:
- The created session.
- Throws:
HibernateException- Indicates a peroblem opening the session; pretty rare here.
-
openSession
Description copied from interface:SessionFactoryOpen aSession, utilizing the specfied JDBCConnection.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
ConnectionProviderinstead as a highly recommended alternative.- Specified by:
openSessionin interfaceSessionFactory- Parameters:
conn- a connection provided by the application.- Returns:
- The created session.
-
getCurrentSession
Description copied from interface:SessionFactoryObtains the current session. The definition of what exactly "current" means controlled by theCurrentSessionContextimpl configured for use. Note that for backwards compatibility, if aCurrentSessionContextis not configured but a JTATransactionManagerLookupis configured this will default to theJTASessionContextimpl.- Specified by:
getCurrentSessionin interfaceSessionFactory- Returns:
- The current session.
-
getReference
- Specified by:
getReferencein interfaceReferenceable- Throws:
NamingException- See Also:
-
getClassMetadata
Description copied from interface:SessionFactoryRetrieve theClassMetadataassociated with the given entity class.- Specified by:
getClassMetadatain interfaceSessionFactory- Parameters:
persistentClass- The entity class- Returns:
- The metadata associated with the given entity; may be null if no such entity was mapped.
- Throws:
HibernateException- Generally null is returned instead of throwing.
-
getClassMetadata
Description copied from interface:SessionFactoryRetrieve theClassMetadataassociated with the given entity class.- Specified by:
getClassMetadatain interfaceSessionFactory- Parameters:
entityName- The entity class- Returns:
- The metadata associated with the given entity; may be null if no such entity was mapped.
- Throws:
HibernateException- Generally null is returned instead of throwing.
-
getCollectionMetadata
Description copied from interface:SessionFactoryGet theCollectionMetadataassociated with the named collection role.- Specified by:
getCollectionMetadatain interfaceSessionFactory- Parameters:
roleName- The collection role (in form [owning-entity-name].[collection-property-name]).- Returns:
- The metadata associated with the given collection; may be null if no such collection was mapped.
- Throws:
HibernateException- Generally null is returned instead of throwing.
-
getAllClassMetadata
Description copied from interface:SessionFactoryRetrieve theClassMetadatafor all mapped entities.- Specified by:
getAllClassMetadatain interfaceSessionFactory- Returns:
- A map containing all
ClassMetadatakeyed by the correspondingStringentity-name. - Throws:
HibernateException- Generally empty map is returned instead of throwing.
-
getAllCollectionMetadata
Description copied from interface:SessionFactoryGet theCollectionMetadatafor all mapped collections- Specified by:
getAllCollectionMetadatain interfaceSessionFactory- Returns:
- a map from String to CollectionMetadata
- Throws:
HibernateException- Generally empty map is returned instead of throwing.
-
close
Description copied from interface:SessionFactoryDestroy this SessionFactory and release all resources (caches, connection pools, etc). It is the responsibility of the application to ensure that there are no opensessionsbefore calling this method as the impact on thosesessionsis indeterminate. No-ops if alreadyclosed.- Specified by:
closein interfaceSessionFactory- Throws:
HibernateException- Indicates an issue closing the factory.
-
isClosed
public boolean isClosed()Description copied from interface:SessionFactoryIs this factory already closed?- Specified by:
isClosedin interfaceSessionFactory- Returns:
- True if this factory is already closed; false otherwise.
-
getCache
Description copied from interface:SessionFactoryObtain direct access to the underlying cache regions.- Specified by:
getCachein interfaceSessionFactory- Returns:
- The direct cache access API.
-
evict
Description copied from interface:SessionFactoryEvict an entry from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.- Specified by:
evictin interfaceSessionFactory- Parameters:
persistentClass- The entity class for which to evict data.id- The entity id- Throws:
HibernateException- Generally will mean that either that 'persisttentClass' did not name a mapped entity or a problem communicating with underlying cache impl.
-
evict
Description copied from interface:SessionFactoryEvict all entries from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.- Specified by:
evictin interfaceSessionFactory- Parameters:
persistentClass- The entity class for which to evict data.- Throws:
HibernateException- Generally will mean that either that 'persisttentClass' did not name a mapped entity or a problem communicating with underlying cache impl.
-
evictEntity
Description copied from interface:SessionFactoryEvict an entry from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.- Specified by:
evictEntityin interfaceSessionFactory- Parameters:
entityName- The entity name for which to evict data.id- The entity id- Throws:
HibernateException- Generally will mean that either that 'persisttentClass' did not name a mapped entity or a problem communicating with underlying cache impl.
-
evictEntity
Description copied from interface:SessionFactoryEvict all entries from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.- Specified by:
evictEntityin interfaceSessionFactory- Parameters:
entityName- The entity name for which to evict data.- Throws:
HibernateException- Generally will mean that either that 'persisttentClass' did not name a mapped entity or a problem communicating with underlying cache impl.
-
evictCollection
Description copied from interface:SessionFactoryEvict an entry from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.- Specified by:
evictCollectionin interfaceSessionFactory- Parameters:
roleName- The name of the collection roleid- The id of the collection owner- Throws:
HibernateException- Generally will mean that either that 'roleName' did not name a mapped collection or a problem communicating with underlying cache impl.
-
evictCollection
Description copied from interface:SessionFactoryEvict all entries from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.- Specified by:
evictCollectionin interfaceSessionFactory- Parameters:
roleName- The name of the collection role whose regions should be evicted- Throws:
HibernateException- Generally will mean that either that 'roleName' did not name a mapped collection or a problem communicating with underlying cache impl.
-
evictQueries
Description copied from interface:SessionFactoryEvict any query result sets cached in the default query cache region.- Specified by:
evictQueriesin interfaceSessionFactory- Throws:
HibernateException- Indicate a problem communicating with underlying cache impl.
-
evictQueries
Description copied from interface:SessionFactoryEvict any query result sets cached in the named query cache region.- Specified by:
evictQueriesin interfaceSessionFactory- Parameters:
cacheRegion- The named query cache region from which to evict.- Throws:
HibernateException- Since a not-found 'cacheRegion' simply no-ops, this should indicate a problem communicating with underlying cache impl.
-
getStatistics
Description copied from interface:SessionFactoryRetrieve the statistics fopr this factory.- Specified by:
getStatisticsin interfaceSessionFactory- Returns:
- The statistics.
-
openStatelessSession
Description copied from interface:SessionFactoryOpen a new stateless session.- Specified by:
openStatelessSessionin interfaceSessionFactory- Returns:
- The created stateless session.
-
openStatelessSession
Description copied from interface:SessionFactoryOpen a new stateless session, utilizing the specified JDBCConnection.- Specified by:
openStatelessSessionin interfaceSessionFactory- Parameters:
conn- Connection provided by the application.- Returns:
- The created stateless session.
-
getDefinedFilterNames
Description copied from interface:SessionFactoryObtain a set of the names of all filters defined on this SessionFactory.- Specified by:
getDefinedFilterNamesin interfaceSessionFactory- Returns:
- The set of filter names.
-
getFilterDefinition
Description copied from interface:SessionFactoryObtain the definition of a filter by name.- Specified by:
getFilterDefinitionin interfaceSessionFactory- Parameters:
filterName- The name of the filter for which to obtain the definition.- Returns:
- The filter definition.
- Throws:
HibernateException- If no filter defined with the given name.
-
containsFetchProfileDefinition
Description copied from interface:SessionFactoryDetermine if this session factory contains a fetch profile definition registered under the given name.- Specified by:
containsFetchProfileDefinitionin interfaceSessionFactory- Parameters:
name- The name to check- Returns:
- True if there is such a fetch profile; false otherwise.
-
getTypeHelper
Description copied from interface:SessionFactoryRetrieve this factory'sTypeHelper- Specified by:
getTypeHelperin interfaceSessionFactory- Returns:
- The factory's
TypeHelper
-