public class

SessionFactoryStub

extends Object
implements SessionFactory
java.lang.Object
   ↳ org.hibernate.jmx.SessionFactoryStub

Class Overview

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.

Summary

Public Methods
void close()
Destroy this SessionFactory and release all resources (caches, connection pools, etc).
boolean containsFetchProfileDefinition(String name)
Determine if this session factory contains a fetch profile definition registered under the given name.
void evict(Class persistentClass, Serializable id)
Evict an entry from the second-level cache.
void evict(Class persistentClass)
Evict all entries from the second-level cache.
void evictCollection(String roleName, Serializable id)
Evict an entry from the second-level cache.
void evictCollection(String roleName)
Evict all entries from the second-level cache.
void evictEntity(String entityName, Serializable id)
Evict an entry from the second-level cache.
void evictEntity(String entityName)
Evict all entries 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<StringClassMetadata> getAllClassMetadata()
Retrieve the ClassMetadata for all mapped entities.
Map getAllCollectionMetadata()
Get the CollectionMetadata for all mapped collections
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.
Session getCurrentSession()
Obtains the current session.
Set getDefinedFilterNames()
Obtain a set of the names of all filters defined on this SessionFactory.
FilterDefinition getFilterDefinition(String filterName)
Obtain the definition of a filter by name.
Reference getReference()
Statistics getStatistics()
Retrieve the statistics fopr this factory.
TypeHelper getTypeHelper()
Retrieve this factory's TypeHelper
boolean isClosed()
Is this factory already closed?
Session openSession(Connection connection, Interceptor interceptor)
Open a Session, utilizing the specfied JDBC Connection and specified Interceptor.
Session openSession()
Open a Session.
Session openSession(Connection conn)
Open a Session, utilizing the specfied JDBC Connection.
Session openSession(Interceptor interceptor)
Open a Session, utilizing the specified Interceptor.
StatelessSession openStatelessSession(Connection conn)
Open a new stateless session, utilizing the specified JDBC Connection.
StatelessSession openStatelessSession()
Open a new stateless session.
[Expand]
Inherited Methods
From class java.lang.Object
From interface javax.naming.Referenceable
From interface org.hibernate.SessionFactory

Public Methods

public void close ()

Destroy this SessionFactory and release all resources (caches, connection pools, etc).

It is the responsibility of the application to ensure that there are no open sessions before calling this method as the impact on those sessions is indeterminate.

No-ops if already closed.

public boolean containsFetchProfileDefinition (String name)

Determine if this session factory contains a fetch profile definition registered under the given name.

Parameters
name The name to check
Returns
  • True if there is such a fetch profile; false otherwise.

public void evict (Class persistentClass, Serializable id)

Evict 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.

Parameters
persistentClass The entity class for which to evict data.
id The entity id

public void evict (Class persistentClass)

Evict 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.

Parameters
persistentClass The entity class for which to evict data.

public void evictCollection (String roleName, Serializable id)

Evict 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.

Parameters
roleName The name of the collection role
id The id of the collection owner

public void evictCollection (String roleName)

Evict 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.

Parameters
roleName The name of the collection role whose regions should be evicted

public void evictEntity (String entityName, Serializable id)

Evict 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.

Parameters
entityName The entity name for which to evict data.
id The entity id

public void evictEntity (String entityName)

Evict 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.

Parameters
entityName The entity name for which to evict data.

public void evictQueries ()

Evict any query result sets cached in the default query cache region.

public void evictQueries (String cacheRegion)

Evict any query result sets cached in the named query cache region.

Parameters
cacheRegion The named query cache region from which to evict.

public Map<StringClassMetadata> getAllClassMetadata ()

Retrieve the ClassMetadata for all mapped entities.

Returns

public Map getAllCollectionMetadata ()

Get the CollectionMetadata for all mapped collections

Returns
  • a map from String to CollectionMetadata

public Cache getCache ()

Obtain direct access to the underlying cache regions.

Returns
  • The direct cache access API.

public ClassMetadata getClassMetadata (Class persistentClass)

Retrieve the ClassMetadata associated with the given entity class.

Parameters
persistentClass The entity class
Returns
  • The metadata associated with the given entity; may be null if no such entity was mapped.

public ClassMetadata getClassMetadata (String entityName)

Retrieve the ClassMetadata associated with the given entity class.

Parameters
entityName The entity class
Returns
  • The metadata associated with the given entity; may be null if no such entity was mapped.

public CollectionMetadata getCollectionMetadata (String roleName)

Get the CollectionMetadata associated with the named collection role.

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.

public Session getCurrentSession ()

Obtains the current session. The definition of what exactly "current" means controlled by the CurrentSessionContext 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.

Returns
  • The current session.

public Set getDefinedFilterNames ()

Obtain a set of the names of all filters defined on this SessionFactory.

Returns
  • The set of filter names.

public FilterDefinition getFilterDefinition (String filterName)

Obtain the definition of a filter by name.

Parameters
filterName The name of the filter for which to obtain the definition.
Returns
  • The filter definition.

public Reference getReference ()

public Statistics getStatistics ()

Retrieve the statistics fopr this factory.

Returns
  • The statistics.

public TypeHelper getTypeHelper ()

Retrieve this factory's TypeHelper

Returns

public boolean isClosed ()

Is this factory already closed?

Returns
  • True if this factory is already closed; false otherwise.

public Session openSession (Connection connection, Interceptor interceptor)

Open a Session, utilizing the specfied JDBC Connection and specified Interceptor.

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 instead as a highly recommended alternative.

Parameters
connection a connection provided by the application.
interceptor a session-scoped interceptor
Returns
  • The created session.

public Session openSession ()

Open a Session.

JDBC connection(s will be obtained from the configured ConnectionProvider as needed to perform requested work.

Returns
  • The created session.

public Session openSession (Connection conn)

Open a Session, utilizing the specfied JDBC Connection.

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 instead as a highly recommended alternative.

Parameters
conn a connection provided by the application.
Returns
  • The created session.

public Session openSession (Interceptor interceptor)

Open a Session, utilizing the specified Interceptor.

JDBC connection(s will be obtained from the configured ConnectionProvider as needed to perform requested work.

Parameters
interceptor a session-scoped interceptor
Returns
  • The created session.

public StatelessSession openStatelessSession (Connection conn)

Open a new stateless session, utilizing the specified JDBC Connection.

Parameters
conn Connection provided by the application.
Returns
  • The created stateless session.

public StatelessSession openStatelessSession ()

Open a new stateless session.

Returns
  • The created stateless session.