java.lang.Object | |
↳ | org.hibernate.context.JTASessionContext |
An implementation of CurrentSessionContext
which scopes the notion
of a current session to a JTA transaction. Because JTA gives us a nice
tie-in to clean up after ourselves, this implementation will generate
Sessions as needed provided a JTA transaction is in effect. If a session
is not already associated with the current JTA transaction at the time
currentSession()
is called, a new session will be opened and it
will be associated with that JTA transaction.
auto-flush
and
auto-close
attributes set to
true, meaning that the Session will be automatically flushed and closed
as part of the lifecycle for the JTA transaction to which it is associated.
Additionally, it will also be configured to aggressively release JDBC
connections after each statement is executed. These settings are governed
by the isAutoFlushEnabled()
, isAutoCloseEnabled()
, and
getConnectionReleaseMode()
methods; these are provided (along with
the buildOrObtainSession()
method) for easier subclassing for custom
JTA-based session tracking logic (like maybe long-session semantics).
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
JTASessionContext.CleanupSynch | JTA transaction synch used for cleanup of the internal session map. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
factory |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Retrieve the current session according to the scoping defined
by this implementation.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Strictly provided for subclassing purposes; specifically to allow long-session
support.
| |||||||||||
Mainly for subclass usage.
| |||||||||||
Mainly for subclass usage.
| |||||||||||
Mainly for subclass usage.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.hibernate.context.CurrentSessionContext
|
Retrieve the current session according to the scoping defined by this implementation.
HibernateException |
---|
Strictly provided for subclassing purposes; specifically to allow long-session support.
This implementation always just opens a new session.Mainly for subclass usage. This impl always returns after_statement.
Mainly for subclass usage. This impl always returns true.
Mainly for subclass usage. This impl always returns true.