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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Cleanup.voidClose prepared statements.voidDecrement the stack depth by one.booleangetBatch()Getter for the batch of the session.static longMethod to get a unique ID.Gets the prepared statement.intGet 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.inthashCode()booleanChecks for prepared statement.booleanChecks for prepared statement for.voidIncrement the stack depth by one.booleanGetter to tell if a commit is required for the session.booleanTells us if we are in batch mode or not.voidputPreparedStatement(SqlMapExecutorDelegate delegate, String sql, PreparedStatement ps) Put prepared statement.voidRestores the previously saved transaction state.voidSaves the current transaction state.voidStter for the batch of the session.voidsetCommitRequired(boolean commitRequired) Setter to tell the session that a commit is required for the session.voidsetInBatch(boolean inBatch) Turn batch mode on or off.voidsetSqlMapClient(SqlMapClient sqlMapClient) Set the SqlMapClient for the session.voidsetSqlMapExecutor(SqlMapExecutor sqlMapExecutor) Get the SQL executor for the session.voidsetSqlMapTxMgr(SqlMapTransactionManager sqlMapTxMgr) Set the transaction manager.voidsetTransaction(Transaction transaction) Setter for the session transaction.voidsetTransactionState(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.
-