|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.hibernate.session.HibernateContext
SessionFactory.getCurrentSession()
method is the preferred approach to managing "transaction contextual sessions".
public class HibernateContext
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 Session
associated with
the current context.
Constructor Summary | |
---|---|
HibernateContext()
Deprecated. |
Method Summary | |
---|---|
static org.hibernate.Session |
getSession(String name)
Deprecated. Given a SessionFactory, sf (usually obtained from JNDI), this method is equivalent to sf.getCurrentSession(). |
static org.hibernate.Session |
getUnmanagedSession(String name)
Deprecated. Given a SessionFactory, sf (usually obtained from JNDI), this method is equivalent to sf.openSession( sf.getCurrentSession().connection() ) |
static void |
releaseUnmanagedSession(org.hibernate.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 org.hibernate.Session getUnmanagedSession(String name) throws org.hibernate.HibernateException, 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(org.hibernate.Session)
.
name
- The "name" of the SessionFactory
for which an unmanaged session is requested.
org.hibernate.HibernateException
- If an error occurs opening the new Session.
IllegalStateException
- If unable to locate a managed Session for the current context.public static void releaseUnmanagedSession(org.hibernate.Session unmanagedSession) throws org.hibernate.HibernateException
getUnmanagedSession(String)
unmanagedSession
- The unmanaged Session to release.
org.hibernate.HibernateException
- If an error occurs releasing the unmanaged Session.public static org.hibernate.Session getSession(String name)
sf.getCurrentSession().
name
- The "name" of the SessionFactory
for which a session is requested.
SessionFactory.getCurrentSession()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |