|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jodd.db.DbSession jodd.db.DbThreadSession
public class DbThreadSession
Thread assigned DbSession
. Upon creation, it assigns
the session to current thread. Useful when only one session (i.e. connection)
is used per thread, through service layers.
DbThreadSession
uses ThreadDbSessionHolder
for storing
created sessions in the thread storage. Note that holder may be manipulated from outside
of this class.
Field Summary |
---|
Fields inherited from class jodd.db.DbSession |
---|
connection, DEFAULT_TX_MODE, queries, txActive, txMode |
Constructor Summary | |
---|---|
DbThreadSession()
Creates new db session and assigns it to the current thread, using default connection provider. |
|
DbThreadSession(ConnectionProvider connectionProvider)
Creates new db session and assigns it to the current thread. |
Method Summary | |
---|---|
void |
closeSession()
Closes current session and remove the association from current thread. |
static void |
closeThreadSession()
Closes thread session. |
static DbSession |
getCurrentSession()
Returns current thread session or null if no session is assigned
to a thread. |
static DbThreadSession |
getThreadSession()
Returns existing thread session, or new one if already not exist. |
static void |
registerConnectionProvider(ConnectionProvider cp)
Registers default connection provider. |
Methods inherited from class jodd.db.DbSession |
---|
beginTransaction, beginTransaction, checkActiveTx, checkClosedTx, checkOpenSession, closeTx, commitTransaction, getConnection, getTotalActiveQueries, getTotalQueries, isSessionClosed, isTransactionActive, openConnectionForQuery, openTx, rollbackTransaction |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DbThreadSession(ConnectionProvider connectionProvider)
connectionProvider
- connection providerpublic DbThreadSession()
registerConnectionProvider(jodd.db.connection.ConnectionProvider)
Method Detail |
---|
public void closeSession()
closeSession
in class DbSession
DbSession.closeSession()
public static DbSession getCurrentSession()
null
if no session is assigned
to a thread.
public static void registerConnectionProvider(ConnectionProvider cp)
public static DbThreadSession getThreadSession()
registerConnectionProvider(jodd.db.connection.ConnectionProvider)
public static void closeThreadSession()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |