Package com.ibatis.sqlmap.engine.impl
Class SqlMapExecutorDelegate
java.lang.Object
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate
The workhorse that really runs the SQL.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCacheModel
(CacheModel model) Add a cache model.void
Add a mapped statement.void
Add a parameter map.void
addResultMap
(ResultMap map) Add a result map.protected void
autoCommitTransaction
(SessionScope sessionScope, boolean autoStart) Auto commit transaction.protected void
autoEndTransaction
(SessionScope sessionScope, boolean autoStart) Auto end transaction.protected Transaction
autoStartTransaction
(SessionScope sessionScope, boolean autoStart, Transaction trans) Auto start transaction.protected SessionScope
Begin session scope.protected StatementScope
beginStatementScope
(SessionScope sessionScope, MappedStatement mappedStatement) Begin statement scope.void
commitTransaction
(SessionScope sessionScope) Commit the transaction on a session.int
delete
(SessionScope sessionScope, String id, Object param) Execute a delete statement.protected void
endSessionScope
(SessionScope sessionScope) End session scope.protected void
endStatementScope
(StatementScope statementScope) End statement scope.void
endTransaction
(SessionScope sessionScope) End the transaction on a session.boolean
int
executeBatch
(SessionScope sessionScope) Execute a batch for a session.executeBatchDetailed
(SessionScope sessionScope) Execute a batch for a session.void
Flush all of the data caches.void
flushDataCache
(String id) Flush a single cache by ID.getCacheModel
(String id) Get a cache model by ID.Get an iterator of the cache models.Getter for the DataExchangeFactory.Get the DataSource for the session.Get a mappedstatement by its ID.Get an iterator of the mapped statements.int
Deprecated.Get a parameter map by ID.Get an iterator of all of the parameter maps.getResultMap
(String id) Get a result map by ID.Get an iterator of the result maps.Gets the result object factory.Getter for the SqlExecutor.getTransaction
(SessionScope sessionScope) Get a transaction for the session.Getter for the transaction manager.Getter for the TypeHandlerFactory.int
hashCode()
insert
(SessionScope sessionScope, String id, Object param) Call an insert statement by ID.boolean
Getter for the status of caching.boolean
Getter for the status of CGLib enhancements.boolean
Checks if is force multiple result set support.boolean
Getter for the status of lazy loading.boolean
Checks if is statement cache enabled.boolean
Checks if is use column label.queryForList
(SessionScope sessionScope, String id, Object paramObject) Execute a query for a list.queryForList
(SessionScope sessionScope, String id, Object paramObject, int skip, int max) Execute a query for a list.queryForMap
(SessionScope sessionScope, String id, Object paramObject, String keyProp) Execute a query for a map.queryForMap
(SessionScope sessionScope, String id, Object paramObject, String keyProp, String valueProp) Execute a query for a map.queryForObject
(SessionScope sessionScope, String id, Object paramObject) Execute a select for a single object.queryForObject
(SessionScope sessionScope, String id, Object paramObject, Object resultObject) Execute a select for a single object.queryForPaginatedList
(SessionScope sessionScope, String id, Object paramObject, int pageSize) Deprecated.All paginated list features have been deprecatedvoid
queryWithRowHandler
(SessionScope sessionScope, String id, Object paramObject, RowHandler rowHandler) Execute a query with a row handler.void
setCacheModelsEnabled
(boolean cacheModelsEnabled) Turn on or off caching.void
setCustomExecutor
(String sqlExecutorClass) Sets the custom executor.void
setEnhancementEnabled
(boolean enhancementEnabled) Turn on or off CGLib enhancements.void
setForceMultipleResultSetSupport
(boolean forceMultipleResultSetSupport) Sets the force multiple result set support.void
setLazyLoadingEnabled
(boolean lazyLoadingEnabled) Turn on or off lazy loading.void
setResultObjectFactory
(ResultObjectFactory resultObjectFactory) Sets the result object factory.void
setStatementCacheEnabled
(boolean statementCacheEnabled) Sets the statement cache enabled.void
setTxManager
(TransactionManager txManager) Setter for the transaction manager.void
setUseColumnLabel
(boolean useColumnLabel) Sets the use column label.void
setUserProvidedTransaction
(SessionScope sessionScope, Connection userConnection) Use a user-provided transaction for a session.void
startBatch
(SessionScope sessionScope) Start a batch for a session.void
startTransaction
(SessionScope sessionScope) Start a transaction on the session.void
startTransaction
(SessionScope sessionScope, int transactionIsolation) Start a transaction on the session with the specified isolation level.int
update
(SessionScope sessionScope, String id, Object param) Execute an update statement.
-
Field Details
-
sqlExecutor
The sql executor.
-
-
Constructor Details
-
SqlMapExecutorDelegate
public SqlMapExecutorDelegate()Default constructor.
-
-
Method Details
-
setCustomExecutor
Sets the custom executor.- Parameters:
sqlExecutorClass
- the new custom executor
-
getMaxTransactions
public int getMaxTransactions()Deprecated.DO NOT DEPEND ON THIS. Here to avoid breaking spring integration.- Returns:
- the max transactions
-
getDataExchangeFactory
Getter for the DataExchangeFactory.- Returns:
- - the DataExchangeFactory
-
getTypeHandlerFactory
Getter for the TypeHandlerFactory.- Returns:
- - the TypeHandlerFactory
-
isLazyLoadingEnabled
public boolean isLazyLoadingEnabled()Getter for the status of lazy loading.- Returns:
- - the status
-
setLazyLoadingEnabled
public void setLazyLoadingEnabled(boolean lazyLoadingEnabled) Turn on or off lazy loading.- Parameters:
lazyLoadingEnabled
- - the new state of caching
-
isCacheModelsEnabled
public boolean isCacheModelsEnabled()Getter for the status of caching.- Returns:
- - the status
-
setCacheModelsEnabled
public void setCacheModelsEnabled(boolean cacheModelsEnabled) Turn on or off caching.- Parameters:
cacheModelsEnabled
- - the new state of caching
-
isEnhancementEnabled
public boolean isEnhancementEnabled()Getter for the status of CGLib enhancements.- Returns:
- - the status
-
setEnhancementEnabled
public void setEnhancementEnabled(boolean enhancementEnabled) Turn on or off CGLib enhancements.- Parameters:
enhancementEnabled
- - the new state
-
isUseColumnLabel
public boolean isUseColumnLabel()Checks if is use column label.- Returns:
- true, if is use column label
-
setUseColumnLabel
public void setUseColumnLabel(boolean useColumnLabel) Sets the use column label.- Parameters:
useColumnLabel
- the new use column label
-
getTxManager
Getter for the transaction manager.- Returns:
- - the transaction manager
-
setTxManager
Setter for the transaction manager.- Parameters:
txManager
- - the transaction manager
-
addMappedStatement
Add a mapped statement.- Parameters:
ms
- - the mapped statement to add
-
getMappedStatementNames
Get an iterator of the mapped statements.- Returns:
- - the iterator
-
getMappedStatement
Get a mappedstatement by its ID.- Parameters:
id
- - the statement ID- Returns:
- - the mapped statement
-
addCacheModel
Add a cache model.- Parameters:
model
- - the model to add
-
getCacheModelNames
Get an iterator of the cache models.- Returns:
- - the cache models
-
getCacheModel
Get a cache model by ID.- Parameters:
id
- - the ID- Returns:
- - the cache model
-
addResultMap
Add a result map.- Parameters:
map
- - the result map to add
-
getResultMapNames
Get an iterator of the result maps.- Returns:
- - the result maps
-
getResultMap
Get a result map by ID.- Parameters:
id
- - the ID- Returns:
- - the result map
-
addParameterMap
Add a parameter map.- Parameters:
map
- - the map to add
-
getParameterMapNames
Get an iterator of all of the parameter maps.- Returns:
- - the parameter maps
-
getParameterMap
Get a parameter map by ID.- Parameters:
id
- - the ID- Returns:
- - the parameter map
-
flushDataCache
public void flushDataCache()Flush all of the data caches. -
flushDataCache
Flush a single cache by ID.- Parameters:
id
- - the ID
-
insert
Call an insert statement by ID.- Parameters:
sessionScope
- - the sessionid
- - the statement IDparam
- - the parameter object- Returns:
- - the generated key (or null)
- Throws:
SQLException
- - if the insert fails
-
update
Execute an update statement.- Parameters:
sessionScope
- - the session scopeid
- - the statement IDparam
- - the parameter object- Returns:
- - the number of rows updated
- Throws:
SQLException
- - if the update fails
-
delete
Execute a delete statement.- Parameters:
sessionScope
- - the session scopeid
- - the statement IDparam
- - the parameter object- Returns:
- - the number of rows deleted
- Throws:
SQLException
- - if the delete fails
-
queryForObject
public Object queryForObject(SessionScope sessionScope, String id, Object paramObject) throws SQLException Execute a select for a single object.- Parameters:
sessionScope
- - the session scopeid
- - the statement IDparamObject
- - the parameter object- Returns:
- - the result of the query
- Throws:
SQLException
- - if the query fails
-
queryForObject
public Object queryForObject(SessionScope sessionScope, String id, Object paramObject, Object resultObject) throws SQLException Execute a select for a single object.- Parameters:
sessionScope
- - the session scopeid
- - the statement IDparamObject
- - the parameter objectresultObject
- - the result object (if not supplied or null, a new object will be created)- Returns:
- - the result of the query
- Throws:
SQLException
- - if the query fails
-
queryForList
public List queryForList(SessionScope sessionScope, String id, Object paramObject) throws SQLException Execute a query for a list.- Parameters:
sessionScope
- - the session scopeid
- - the statement IDparamObject
- - the parameter object- Returns:
- - the data list
- Throws:
SQLException
- - if the query fails
-
queryForList
public List queryForList(SessionScope sessionScope, String id, Object paramObject, int skip, int max) throws SQLException Execute a query for a list.- Parameters:
sessionScope
- - the session scopeid
- - the statement IDparamObject
- - the parameter objectskip
- - the number of rows to skipmax
- - the maximum number of rows to return- Returns:
- - the data list
- Throws:
SQLException
- - if the query fails
-
queryWithRowHandler
public void queryWithRowHandler(SessionScope sessionScope, String id, Object paramObject, RowHandler rowHandler) throws SQLException Execute a query with a row handler. The row handler is called once per row in the query results.- Parameters:
sessionScope
- - the session scopeid
- - the statement IDparamObject
- - the parameter objectrowHandler
- - the row handler- Throws:
SQLException
- - if the query fails
-
queryForPaginatedList
public PaginatedList queryForPaginatedList(SessionScope sessionScope, String id, Object paramObject, int pageSize) throws SQLException Deprecated.All paginated list features have been deprecatedExecute a query and return a paginated list.- Parameters:
sessionScope
- - the session scopeid
- - the statement IDparamObject
- - the parameter objectpageSize
- - the page size- Returns:
- - the data list
- Throws:
SQLException
- - if the query fails
-
queryForMap
public Map queryForMap(SessionScope sessionScope, String id, Object paramObject, String keyProp) throws SQLException Execute a query for a map. The map has the table key as the key, and the results as the map data- Parameters:
sessionScope
- - the session scopeid
- - the statement IDparamObject
- - the parameter objectkeyProp
- - the key property (from the results for the map)- Returns:
- - the Map
- Throws:
SQLException
- - if the query fails
-
queryForMap
public Map queryForMap(SessionScope sessionScope, String id, Object paramObject, String keyProp, String valueProp) throws SQLException Execute a query for a map. The map has the table key as the key, and a property from the results as the map data- Parameters:
sessionScope
- - the session scopeid
- - the statement IDparamObject
- - the parameter objectkeyProp
- - the property for the map keyvalueProp
- - the property for the map data- Returns:
- - the Map
- Throws:
SQLException
- - if the query fails
-
startTransaction
Start a transaction on the session.- Parameters:
sessionScope
- - the session- Throws:
SQLException
- - if the transaction could not be started
-
startTransaction
public void startTransaction(SessionScope sessionScope, int transactionIsolation) throws SQLException Start a transaction on the session with the specified isolation level.- Parameters:
sessionScope
- - the sessiontransactionIsolation
- the transaction isolation- Throws:
SQLException
- - if the transaction could not be started
-
commitTransaction
Commit the transaction on a session.- Parameters:
sessionScope
- - the session- Throws:
SQLException
- - if the transaction could not be committed
-
endTransaction
End the transaction on a session.- Parameters:
sessionScope
- - the session- Throws:
SQLException
- - if the transaction could not be ended
-
startBatch
Start a batch for a session.- Parameters:
sessionScope
- - the session
-
executeBatch
Execute a batch for a session.- Parameters:
sessionScope
- - the session- Returns:
- - the number of rows impacted by the batch
- Throws:
SQLException
- - if the batch fails
-
executeBatchDetailed
Execute a batch for a session.- Parameters:
sessionScope
- - the session- Returns:
- - a List of BatchResult objects (may be null if no batch has been initiated). There will be one BatchResult object in the list for each sub-batch executed
- Throws:
SQLException
- if a database access error occurs, or the drive does not support batch statementsBatchException
- if the driver throws BatchUpdateException
-
setUserProvidedTransaction
Use a user-provided transaction for a session.- Parameters:
sessionScope
- - the session scopeuserConnection
- - the user supplied connection
-
getDataSource
Get the DataSource for the session.- Returns:
- - the DataSource
-
getSqlExecutor
Getter for the SqlExecutor.- Returns:
- the SqlExecutor
-
getTransaction
Get a transaction for the session.- Parameters:
sessionScope
- - the session- Returns:
- - the transaction
-
autoEndTransaction
Auto end transaction.- Parameters:
sessionScope
- the session scopeautoStart
- the auto start- Throws:
SQLException
- the SQL exception
-
autoCommitTransaction
protected void autoCommitTransaction(SessionScope sessionScope, boolean autoStart) throws SQLException Auto commit transaction.- Parameters:
sessionScope
- the session scopeautoStart
- the auto start- Throws:
SQLException
- the SQL exception
-
autoStartTransaction
protected Transaction autoStartTransaction(SessionScope sessionScope, boolean autoStart, Transaction trans) throws SQLException Auto start transaction.- Parameters:
sessionScope
- the session scopeautoStart
- the auto starttrans
- the trans- Returns:
- the transaction
- Throws:
SQLException
- the SQL exception
-
equals
-
hashCode
public int hashCode() -
beginStatementScope
protected StatementScope beginStatementScope(SessionScope sessionScope, MappedStatement mappedStatement) Begin statement scope.- Parameters:
sessionScope
- the session scopemappedStatement
- the mapped statement- Returns:
- the statement scope
-
endStatementScope
End statement scope.- Parameters:
statementScope
- the statement scope
-
beginSessionScope
Begin session scope.- Returns:
- the session scope
-
endSessionScope
End session scope.- Parameters:
sessionScope
- the session scope
-
getResultObjectFactory
Gets the result object factory.- Returns:
- the result object factory
-
setResultObjectFactory
Sets the result object factory.- Parameters:
resultObjectFactory
- the new result object factory
-
isStatementCacheEnabled
public boolean isStatementCacheEnabled()Checks if is statement cache enabled.- Returns:
- true, if is statement cache enabled
-
setStatementCacheEnabled
public void setStatementCacheEnabled(boolean statementCacheEnabled) Sets the statement cache enabled.- Parameters:
statementCacheEnabled
- the new statement cache enabled
-
isForceMultipleResultSetSupport
public boolean isForceMultipleResultSetSupport()Checks if is force multiple result set support.- Returns:
- true, if is force multiple result set support
-
setForceMultipleResultSetSupport
public void setForceMultipleResultSetSupport(boolean forceMultipleResultSetSupport) Sets the force multiple result set support.- Parameters:
forceMultipleResultSetSupport
- the new force multiple result set support
-