|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.hibernate.session.HibernateContext
org.hibernate.SessionFactory#getCurrentSession()
method is the preferred approach to managing "transaction contextual sessions".
Maintains and exposes, for app usage, the current context bound Hibernate Session.
Application code need only deal with the getSession(java.lang.String)
as the means to retreive the org.hibernate.Session associated with
the current context.
| Constructor Summary | |
HibernateContext()
Deprecated. |
|
| Method Summary | |
static Session |
getSession(java.lang.String name)
Deprecated. Given a SessionFactory, sf (usually obtained from JNDI), this method is equivalent to sf.getCurrentSession(). |
static Session |
getUnmanagedSession(java.lang.String name)
Deprecated. Given a SessionFactory, sf (usually obtained from JNDI), this method is equivalent to sf.openSession( sf.getCurrentSession().connection() ) |
static void |
releaseUnmanagedSession(Session unmanagedSession)
Deprecated. See getUnmanagedSession(String) |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public HibernateContext()
| Method Detail |
public static Session getUnmanagedSession(java.lang.String name)
throws HibernateException,
java.lang.IllegalStateException
sf.openSession( sf.getCurrentSession().connection() )
getSession(java.lang.String).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 releaseUnmanagedSession(Session).
name - The "name" of the org.hibernate.SessionFactory
for which an unmanaged session is requested.
HibernateException - If an error occurs opening the new Session.
java.lang.IllegalStateException - If unable to locate a managed Session for the current context.
public static void releaseUnmanagedSession(Session unmanagedSession)
throws HibernateException
getUnmanagedSession(String)
unmanagedSession - The unmanaged Session to release.
HibernateException - If an error occurs releasing the unmanaged Session.public static Session getSession(java.lang.String name)
sf.getCurrentSession().
name - The "name" of the org.hibernate.SessionFactory
for which a session is requested.
org.hibernate.SessionFactory#getCurrentSession()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||