| |
|
| java.lang.Object org.jboss.hibernate.session.HibernateContext
HibernateContext | public class HibernateContext (Code) | | Maintains and exposes, for app usage, the current context bound Hibernate Session.
Application code need only deal with the
HibernateContext.getSession(java.lang.String) as the means to retreive the
org.hibernate.Session associated with
the current context.
author: Steve Ebersole version: $Revision: 57193 $org.hibernate.SessionFactory.getCurrentSession |
Method Summary | |
public static Session | getSession(String name) Retreives the session currently bound to the current context.
Parameters: name - The "name" of the org.hibernate.SessionFactoryfor which a session is requested. | public static Session | getUnmanagedSession(String name) Retreives an "unmanaged" session against the same underlying jdbc connnection as the session
currently bound to the current context for the given JNDI name. | public static void | releaseUnmanagedSession(Session unmanagedSession) Method to release a previously obtained unmanaged session. |
getSession | public static Session getSession(String name)(Code) | | Retreives the session currently bound to the current context.
Parameters: name - The "name" of the org.hibernate.SessionFactoryfor which a session is requested. The current session. See Also: org.hibernate.SessionFactory.getCurrentSession |
getUnmanagedSession | public static Session getUnmanagedSession(String name) throws HibernateException, IllegalStateException(Code) | | Retreives an "unmanaged" session against the same underlying jdbc connnection as the session
currently bound to the current context for the given JNDI name. This is simply a convenience
method for SessionFactory.openSession(
HibernateContext.getSession .connection()). Unmanaged here means that
the returned session is not controlled by the code managing the actually bound session; callers
are required to cleanup these sessions manually using
HibernateContext.releaseUnmanagedSession .
Parameters: name - The "name" of the org.hibernate.SessionFactoryfor which an unmanaged session is requested. An unmanaged session. throws: HibernateException - If an error occurs opening the new Session. throws: IllegalStateException - If unable to locate a managed Session for the current context. |
releaseUnmanagedSession | public static void releaseUnmanagedSession(Session unmanagedSession) throws HibernateException(Code) | | Method to release a previously obtained unmanaged session.
Parameters: unmanagedSession - The unmanaged Session to release. throws: HibernateException - If an error occurs releasing the unmanaged Session.HibernateContext.getUnmanagedSession(String) |
|
|
|