Package com.ibatis.sqlmap.engine.scope
Class SessionScope
java.lang.Object
com.ibatis.sqlmap.engine.scope.SessionScope
A Session based implementation of the Scope interface.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup()
Cleanup.void
Close prepared statements.void
Decrement the stack depth by one.boolean
getBatch()
Getter for the batch of the session.static long
Method to get a unique ID.Gets the prepared statement.int
Get the request stack depth.Get the SqlMapClient for the session.Get the SQL executor for the session.Get the transaction manager.Getter for the session transaction.Getter for the transaction state of the session.int
hashCode()
boolean
Checks for prepared statement.boolean
Checks for prepared statement for.void
Increment the stack depth by one.boolean
Getter to tell if a commit is required for the session.boolean
Tells us if we are in batch mode or not.void
putPreparedStatement
(SqlMapExecutorDelegate delegate, String sql, PreparedStatement ps) Put prepared statement.void
Restores the previously saved transaction state.void
Saves the current transaction state.void
Stter for the batch of the session.void
setCommitRequired
(boolean commitRequired) Setter to tell the session that a commit is required for the session.void
setInBatch
(boolean inBatch) Turn batch mode on or off.void
setSqlMapClient
(SqlMapClient sqlMapClient) Set the SqlMapClient for the session.void
setSqlMapExecutor
(SqlMapExecutor sqlMapExecutor) Get the SQL executor for the session.void
setSqlMapTxMgr
(SqlMapTransactionManager sqlMapTxMgr) Set the transaction manager.void
setTransaction
(Transaction transaction) Setter for the session transaction.void
setTransactionState
(TransactionState transactionState) Setter for the transaction state of the session.
-
Constructor Details
-
SessionScope
public SessionScope()Default constructor.
-
-
Method Details
-
getSqlMapClient
Get the SqlMapClient for the session.- Returns:
- - the SqlMapClient
-
setSqlMapClient
Set the SqlMapClient for the session.- Parameters:
sqlMapClient
- - the SqlMapClient
-
getSqlMapExecutor
Get the SQL executor for the session.- Returns:
- - the SQL executor
-
setSqlMapExecutor
Get the SQL executor for the session.- Parameters:
sqlMapExecutor
- - the SQL executor
-
getSqlMapTxMgr
Get the transaction manager.- Returns:
- - the transaction manager
-
setSqlMapTxMgr
Set the transaction manager.- Parameters:
sqlMapTxMgr
- - the transaction manager
-
isInBatch
public boolean isInBatch()Tells us if we are in batch mode or not.- Returns:
- - true if we are working with a batch
-
setInBatch
public void setInBatch(boolean inBatch) Turn batch mode on or off.- Parameters:
inBatch
- - the switch
-
getTransaction
Getter for the session transaction.- Returns:
- - the transaction
-
setTransaction
Setter for the session transaction.- Parameters:
transaction
- - the transaction
-
getTransactionState
Getter for the transaction state of the session.- Returns:
- - the state
-
setTransactionState
Setter for the transaction state of the session.- Parameters:
transactionState
- - the new transaction state
-
getBatch
Getter for the batch of the session.- Returns:
- - the batch
-
setBatch
Stter for the batch of the session.- Parameters:
batch
- the new batch
-
getRequestStackDepth
public int getRequestStackDepth()Get the request stack depth.- Returns:
- - the stack depth
-
incrementRequestStackDepth
public void incrementRequestStackDepth()Increment the stack depth by one. -
decrementRequestStackDepth
public void decrementRequestStackDepth()Decrement the stack depth by one. -
isCommitRequired
public boolean isCommitRequired()Getter to tell if a commit is required for the session.- Returns:
- - true if a commit is required
-
setCommitRequired
public void setCommitRequired(boolean commitRequired) Setter to tell the session that a commit is required for the session.- Parameters:
commitRequired
- - the flag
-
hasPreparedStatementFor
Checks for prepared statement for.- Parameters:
sql
- the sql- Returns:
- true, if successful
-
hasPreparedStatement
Checks for prepared statement.- Parameters:
ps
- the ps- Returns:
- true, if successful
-
getPreparedStatement
Gets the prepared statement.- Parameters:
sql
- the sql- Returns:
- the prepared statement
- Throws:
SQLException
- the SQL exception
-
putPreparedStatement
Put prepared statement.- Parameters:
delegate
- the delegatesql
- the sqlps
- the ps
-
closePreparedStatements
public void closePreparedStatements()Close prepared statements. -
cleanup
public void cleanup()Cleanup. -
equals
-
hashCode
public int hashCode() -
getNextId
public static long getNextId()Method to get a unique ID.- Returns:
- - the new ID
-
saveTransactionState
public void saveTransactionState()Saves the current transaction state. -
recallTransactionState
public void recallTransactionState()Restores the previously saved transaction state.
-