站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 2.1.8 正式版 API 英文文档

SessionFactoryStub (Hibernate API Documentation) - Hibernate 2.1.8 正式版 API 英文文档


net.sf.hibernate.jmx
Class SessionFactoryStub

java.lang.Object
  extended bynet.sf.hibernate.jmx.SessionFactoryStub
All Implemented Interfaces:
Referenceable, Serializable, SessionFactory

public class SessionFactoryStub
extends Object
implements 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.

Author:
Gavin King
See Also:
Serialized Form

Method Summary
 void close()
          Destroy this SessionFactory and release all resources (caches, connection pools, etc).
 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 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 Class to metadata object
 Map getAllCollectionMetadata()
          Get all CollectionMetadata as a Map from role name to metadata object
 ClassMetadata getClassMetadata(Class persistentClass)
          Get the ClassMetadata associated with the given entity class
 CollectionMetadata getCollectionMetadata(String roleName)
          Get the CollectionMetadata associated with the named collection role
 Reference getReference()
           
 SQLExceptionConverter getSQLExceptionConverter()
          Retrieves the SQLExceptionConverter in effect for this SessionFactory.
 Databinder openDatabinder()
          Create a new databinder.
 Session openSession()
          Create database connection and open a Session on it.
 Session openSession(Connection conn)
          Open a Session on the given connection.
 Session openSession(Connection connection, Interceptor interceptor)
          Open a Session on the given connection, specifying an interceptor.
 Session openSession(Interceptor interceptor)
          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
 

Method Detail

openSession

public Session openSession()
                    throws HibernateException
Description copied from interface: SessionFactory
Create database connection and open a Session on it.

Specified by:
openSession in interface SessionFactory
Returns:
Session
Throws:
HibernateException

openSession

public Session openSession(Connection conn)
Description copied from interface: SessionFactory
Open a Session on the given 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.

Specified by:
openSession in interface SessionFactory
Parameters:
conn - a connection provided by the application.
Returns:
Session

openDatabinder

public Databinder openDatabinder()
                          throws HibernateException
Description copied from interface: SessionFactory
Create a new databinder.

Specified by:
openDatabinder in interface SessionFactory
Returns:
Databinder
Throws:
HibernateException

getReference

public Reference getReference()
                       throws NamingException
Specified by:
getReference in interface Referenceable
Throws:
NamingException
See Also:
Referenceable.getReference()

getClassMetadata

public ClassMetadata getClassMetadata(Class persistentClass)
                               throws HibernateException
Description copied from interface: SessionFactory
Get the ClassMetadata associated with the given entity class

Specified by:
getClassMetadata in interface SessionFactory
Throws:
HibernateException
See Also:
ClassMetadata

getCollectionMetadata

public CollectionMetadata getCollectionMetadata(String roleName)
                                         throws HibernateException
Description copied from interface: SessionFactory
Get the CollectionMetadata associated with the named collection role

Specified by:
getCollectionMetadata in interface SessionFactory
Throws:
HibernateException
See Also:
CollectionMetadata

openSession

public Session openSession(Connection connection,
                           Interceptor interceptor)
Description copied from interface: SessionFactory
Open a Session on the given connection, specifying an 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.

Specified by:
openSession in interface SessionFactory
Parameters:
connection - a connection provided by the application.
interceptor - a session-scoped interceptor
Returns:
Session

openSession

public Session openSession(Interceptor interceptor)
                    throws HibernateException
Description copied from interface: SessionFactory
Create database connection and open a Session on it, specifying an interceptor.

Specified by:
openSession in interface SessionFactory
Parameters:
interceptor - a session-scoped interceptor
Returns:
Session
Throws:
HibernateException

getAllClassMetadata

public Map getAllClassMetadata()
                        throws HibernateException
Description copied from interface: SessionFactory
Get all ClassMetadata as a Map from Class to metadata object

Specified by:
getAllClassMetadata in interface SessionFactory
Returns:
a map from Class to ClassMetaData
Throws:
HibernateException
See Also:
ClassMetadata

getAllCollectionMetadata

public Map getAllCollectionMetadata()
                             throws HibernateException
Description copied from interface: SessionFactory
Get all CollectionMetadata as a Map from role name to metadata object

Specified by:
getAllCollectionMetadata in interface SessionFactory
Returns:
a map from String to CollectionMetadata
Throws:
HibernateException
See Also:
CollectionMetadata

close

public void close()
           throws HibernateException
Description copied from interface: SessionFactory
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 close().

Specified by:
close in interface SessionFactory
Throws:
HibernateException

evict

public void evict(Class persistentClass,
                  Serializable id)
           throws HibernateException
Description copied from interface: SessionFactory
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.

Specified by:
evict in interface SessionFactory
Throws:
HibernateException

evict

public void evict(Class persistentClass)
           throws HibernateException
Description copied from interface: SessionFactory
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.

Specified by:
evict in interface SessionFactory
Throws:
HibernateException

evictCollection

public void evictCollection(String roleName,
                            Serializable id)
                     throws HibernateException
Description copied from interface: SessionFactory
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.

Specified by:
evictCollection in interface SessionFactory
Throws:
HibernateException

evictCollection

public void evictCollection(String roleName)
                     throws HibernateException
Description copied from interface: SessionFactory
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.

Specified by:
evictCollection in interface SessionFactory
Throws:
HibernateException

evictQueries

public void evictQueries()
                  throws HibernateException
Description copied from interface: SessionFactory
Evict any query result sets cached in the default query cache region.

Specified by:
evictQueries in interface SessionFactory
Throws:
HibernateException

evictQueries

public void evictQueries(String cacheRegion)
                  throws HibernateException
Description copied from interface: SessionFactory
Evict any query result sets cached in the named query cache region.

Specified by:
evictQueries in interface SessionFactory
Throws:
HibernateException

getSQLExceptionConverter

public SQLExceptionConverter getSQLExceptionConverter()
Retrieves the SQLExceptionConverter in effect for this SessionFactory.

Specified by:
getSQLExceptionConverter in interface SessionFactory
Returns:
The SQLExceptionConverter for this SessionFactory.