Save This Page
Home » Hibernate-3.3.2.GA » org.hibernate » context » [javadoc | source]
org.hibernate.context
public class: ManagedSessionContext [javadoc | source]
java.lang.Object
   org.hibernate.context.ManagedSessionContext

All Implemented Interfaces:
    CurrentSessionContext

Represents a CurrentSessionContext the notion of a contextual session is managed by some external entity (generally some form of interceptor, etc). This external manager is responsible for scoping these contextual sessions appropriately binding/unbinding them here for exposure to the application through SessionFactory#getCurrentSession calls.

Basically exposes two interfaces.

The underlying storage of the current sessions here is a static ThreadLocal -based map where the sessions are keyed by the the owning session factory.
Constructor:
 public ManagedSessionContext(SessionFactoryImplementor factory) 
Method from org.hibernate.context.ManagedSessionContext Summary:
bind,   currentSession,   hasBind,   sessionMap,   unbind
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.hibernate.context.ManagedSessionContext Detail:
 public static Session bind(Session session) 
    Binds the given session to the current context for its session factory.
 public Session currentSession() 
    {@inheritDoc}
 public static boolean hasBind(SessionFactory factory) 
    Check to see if there is already a session associated with the current thread for the given session factory.
 protected static Map sessionMap() 
 public static Session unbind(SessionFactory factory) 
    Unbinds the session (if one) current associated with the context for the given session.