public interface CurrentSessionContext extends Serializable
Defines the contract for implementations which know how to scope the notion
of a current session
.
<p/>
Implementations should adhere to the following:
<ul>
<li>contain a constructor accepting a single argument of type
SessionFactoryImplementor
<li>should be thread safe
<li>should be fully serializable
</ul>
<p/>
Implementors should be aware that they are also fully responsible for
cleanup of any generated current-sessions.
<p/>
Note that there will be exactly one instance of the configured
CurrentSessionContext implementation per SessionFactory
.
Modifier and Type | Method and Description |
---|---|
Session |
currentSession()
Retrieve the current session according to the scoping defined
by this implementation.
|
Session currentSession() throws HibernateException
Retrieve the current session according to the scoping defined by this implementation.
HibernateException
- Typically indicates an issue
locating or creating the current session.Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.