org.hibernate.context.spi.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.
SessionFactory#getCurrentSession() calls. This
portion is instance-based specific to the session factory owning the given
instance of this impl (there will be one instance of this per each session
factory using this strategy).
hasBind, bind,
and unbind used by the external thing to manage exposure of the
current session it is scoping. This portion is static to allow easy
reference from that external thing.
ThreadLocal-based map where the sessions are keyed by the
the owning session factory.
| Modifier and Type | Field and Description |
|---|---|
| private static final ThreadLocal |
| Access | Constructor and Description |
|---|---|
| public | ManagedSessionContext(SessionFactoryImplementor
The factory this context will service factory)
Deprecated
as a consequence of
Constructs a new ManagedSessionContext
SessionFactoryImplementor being deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
| public static Session | |
| public Session | currentSession()
Implements org.
Deprecated
as a consequence of
Retrieve the current session according to the scoping defined
by this implementation.
Session being deprecated.
|
| private static void | |
| private static Session | existingSession(SessionFactory factory)
Deprecated
as a consequence of
SessionFactory and Session being deprecated.
|
| public static boolean | Returns: True if there is currently a session bound.The factory against which to check for a given session
within the current thread. factory)
Deprecated
as a consequence of
Check to see if there is already a session associated with the current
thread for the given session factory.
SessionFactory being deprecated.
|
| protected static Map | |
| private static Map | |
| public static Session | Returns: The bound session if one, else null.The factory for which to unbind the current session. factory)
Deprecated
as a consequence of
Unbinds the session (if one) current associated with the context for the
given session.
SessionFactory and Session being deprecated.
|
| CONTEXT_TL | back to summary |
|---|---|
| private static final ThreadLocal<Map<SessionFactory, Session>> CONTEXT_TL | |
| ManagedSessionContext | back to summary |
|---|---|
| public ManagedSessionContext(SessionFactoryImplementor factory)
Deprecated as a consequence of Constructs a new ManagedSessionContext
| |
| bind | back to summary |
|---|---|
| public static Session bind(Session session)
Deprecated as a consequence of Binds the given session to the current context for its session factory. | |
| currentSession | back to summary |
|---|---|
| public Session currentSession() Implements org. Doc from org. Deprecated as a consequence of Retrieve the current session according to the scoping defined by this implementation. | |
| doCleanup | back to summary |
|---|---|
| private static void doCleanup() | |
| existingSession | back to summary |
|---|---|
| private static Session existingSession(SessionFactory factory)
Deprecated as a consequence of | |
| hasBind | back to summary |
|---|---|
| public static boolean hasBind(SessionFactory factory)
Deprecated as a consequence of Check to see if there is already a session associated with the current thread for the given session factory.
| |
| sessionMap | back to summary |
|---|---|
| protected static Map | |
| sessionMap | back to summary |
|---|---|
| private static Map | |
| unbind | back to summary |
|---|---|
| public static Session unbind(SessionFactory factory)
Deprecated as a consequence of Unbinds the session (if one) current associated with the context for the given session.
| |