com.ibatis.sqlmap.engine.impl
Class SqlMapExecutorDelegate

java.lang.Object
  extended by com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate

public class SqlMapExecutorDelegate
extends Object

The workhorse that really runs the SQL


Field Summary
protected  SqlExecutor sqlExecutor
           
 
Constructor Summary
SqlMapExecutorDelegate()
          Default constructor
 
Method Summary
 void addCacheModel(CacheModel model)
          Add a cache model
 void addMappedStatement(MappedStatement ms)
          Add a mapped statement
 void addParameterMap(ParameterMap map)
          Add a parameter map
 void addResultMap(ResultMap map)
          Add a result map
protected  void autoCommitTransaction(SessionScope sessionScope, boolean autoStart)
           
protected  void autoEndTransaction(SessionScope sessionScope, boolean autoStart)
           
protected  Transaction autoStartTransaction(SessionScope sessionScope, boolean autoStart, Transaction trans)
           
protected  SessionScope beginSessionScope()
           
protected  StatementScope beginStatementScope(SessionScope sessionScope, MappedStatement mappedStatement)
           
 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)
           
protected  void endStatementScope(StatementScope statementScope)
           
 void endTransaction(SessionScope sessionScope)
          End the transaction on a session
 boolean equals(Object obj)
           
 int executeBatch(SessionScope sessionScope)
          Execute a batch for a session
 List executeBatchDetailed(SessionScope sessionScope)
          Execute a batch for a session
 void flushDataCache()
          Flush all of the data caches
 void flushDataCache(String id)
          Flush a single cache by ID
 CacheModel getCacheModel(String id)
          Get a cache model by ID
 Iterator getCacheModelNames()
          Get an iterator of the cache models
 DataExchangeFactory getDataExchangeFactory()
          Getter for the DataExchangeFactory
 DataSource getDataSource()
          Get the DataSource for the session
 MappedStatement getMappedStatement(String id)
          Get a mappedstatement by its ID
 Iterator getMappedStatementNames()
          Get an iterator of the mapped statements
 int getMaxTransactions()
          Deprecated.  
 ParameterMap getParameterMap(String id)
          Get a parameter map by ID
 Iterator getParameterMapNames()
          Get an iterator of all of the parameter maps
 ResultMap getResultMap(String id)
          Get a result map by ID
 Iterator getResultMapNames()
          Get an iterator of the result maps
 ResultObjectFactory getResultObjectFactory()
           
 SqlExecutor getSqlExecutor()
          Getter for the SqlExecutor
 Transaction getTransaction(SessionScope sessionScope)
          Get a transaction for the session
 TransactionManager getTxManager()
          Getter for the transaction manager
 TypeHandlerFactory getTypeHandlerFactory()
          Getter for the TypeHandlerFactory
 int hashCode()
           
 Object insert(SessionScope sessionScope, String id, Object param)
          Call an insert statement by ID
 boolean isCacheModelsEnabled()
          Getter for the status of caching
 boolean isEnhancementEnabled()
          Getter for the status of CGLib enhancements
 boolean isForceMultipleResultSetSupport()
           
 boolean isLazyLoadingEnabled()
          Getter for the status of lazy loading
 boolean isStatementCacheEnabled()
           
 boolean isUseColumnLabel()
           
 List queryForList(SessionScope sessionScope, String id, Object paramObject)
          Execute a query for a list
 List queryForList(SessionScope sessionScope, String id, Object paramObject, int skip, int max)
          Execute a query for a list
 Map queryForMap(SessionScope sessionScope, String id, Object paramObject, String keyProp)
          Execute a query for a map.
 Map queryForMap(SessionScope sessionScope, String id, Object paramObject, String keyProp, String valueProp)
          Execute a query for a map.
 Object queryForObject(SessionScope sessionScope, String id, Object paramObject)
          Execute a select for a single object
 Object queryForObject(SessionScope sessionScope, String id, Object paramObject, Object resultObject)
          Execute a select for a single object
 PaginatedList queryForPaginatedList(SessionScope sessionScope, String id, Object paramObject, int pageSize)
          Deprecated. All paginated list features have been deprecated
 void 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)
           
 void setEnhancementEnabled(boolean enhancementEnabled)
          Turn on or off CGLib enhancements
 void setForceMultipleResultSetSupport(boolean forceMultipleResultSetSupport)
           
 void setLazyLoadingEnabled(boolean lazyLoadingEnabled)
          Turn on or off lazy loading
 void setResultObjectFactory(ResultObjectFactory resultObjectFactory)
           
 void setStatementCacheEnabled(boolean statementCacheEnabled)
           
 void setTxManager(TransactionManager txManager)
          Setter for the transaction manager
 void setUseColumnLabel(boolean useColumnLabel)
           
 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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sqlExecutor

protected SqlExecutor sqlExecutor
Constructor Detail

SqlMapExecutorDelegate

public SqlMapExecutorDelegate()
Default constructor

Method Detail

setCustomExecutor

public void setCustomExecutor(String sqlExecutorClass)

getMaxTransactions

public int getMaxTransactions()
Deprecated. 

DO NOT DEPEND ON THIS. Here to avoid breaking spring integration.


getDataExchangeFactory

public DataExchangeFactory getDataExchangeFactory()
Getter for the DataExchangeFactory

Returns:
- the DataExchangeFactory

getTypeHandlerFactory

public TypeHandlerFactory 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()

setUseColumnLabel

public void setUseColumnLabel(boolean useColumnLabel)

getTxManager

public TransactionManager getTxManager()
Getter for the transaction manager

Returns:
- the transaction manager

setTxManager

public void setTxManager(TransactionManager txManager)
Setter for the transaction manager

Parameters:
txManager - - the transaction manager

addMappedStatement

public void addMappedStatement(MappedStatement ms)
Add a mapped statement

Parameters:
ms - - the mapped statement to add

getMappedStatementNames

public Iterator getMappedStatementNames()
Get an iterator of the mapped statements

Returns:
- the iterator

getMappedStatement

public MappedStatement getMappedStatement(String id)
Get a mappedstatement by its ID

Parameters:
id - - the statement ID
Returns:
- the mapped statement

addCacheModel

public void addCacheModel(CacheModel model)
Add a cache model

Parameters:
model - - the model to add

getCacheModelNames

public Iterator getCacheModelNames()
Get an iterator of the cache models

Returns:
- the cache models

getCacheModel

public CacheModel getCacheModel(String id)
Get a cache model by ID

Parameters:
id - - the ID
Returns:
- the cache model

addResultMap

public void addResultMap(ResultMap map)
Add a result map

Parameters:
map - - the result map to add

getResultMapNames

public Iterator getResultMapNames()
Get an iterator of the result maps

Returns:
- the result maps

getResultMap

public ResultMap getResultMap(String id)
Get a result map by ID

Parameters:
id - - the ID
Returns:
- the result map

addParameterMap

public void addParameterMap(ParameterMap map)
Add a parameter map

Parameters:
map - - the map to add

getParameterMapNames

public Iterator getParameterMapNames()
Get an iterator of all of the parameter maps

Returns:
- the parameter maps

getParameterMap

public ParameterMap getParameterMap(String id)
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

public void flushDataCache(String id)
Flush a single cache by ID

Parameters:
id - - the ID

insert

public Object insert(SessionScope sessionScope,
                     String id,
                     Object param)
              throws SQLException
Call an insert statement by ID

Parameters:
sessionScope - - the session
id - - the statement ID
param - - the parameter object
Returns:
- the generated key (or null)
Throws:
SQLException - - if the insert fails

update

public int update(SessionScope sessionScope,
                  String id,
                  Object param)
           throws SQLException
Execute an update statement

Parameters:
sessionScope - - the session scope
id - - the statement ID
param - - the parameter object
Returns:
- the number of rows updated
Throws:
SQLException - - if the update fails

delete

public int delete(SessionScope sessionScope,
                  String id,
                  Object param)
           throws SQLException
Execute a delete statement

Parameters:
sessionScope - - the session scope
id - - the statement ID
param - - 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 scope
id - - the statement ID
paramObject - - 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 scope
id - - the statement ID
paramObject - - the parameter object
resultObject - - 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 scope
id - - the statement ID
paramObject - - 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 scope
id - - the statement ID
paramObject - - the parameter object
skip - - the number of rows to skip
max - - 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 scope
id - - the statement ID
paramObject - - the parameter object
rowHandler - - 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 deprecated

Execute a query and return a paginated list

Parameters:
sessionScope - - the session scope
id - - the statement ID
paramObject - - the parameter object
pageSize - - 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 scope
id - - the statement ID
paramObject - - the parameter object
keyProp - - 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 scope
id - - the statement ID
paramObject - - the parameter object
keyProp - - the property for the map key
valueProp - - the property for the map data
Returns:
- the Map
Throws:
SQLException - - if the query fails

startTransaction

public void startTransaction(SessionScope sessionScope)
                      throws SQLException
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 session
Throws:
SQLException - - if the transaction could not be started

commitTransaction

public void commitTransaction(SessionScope sessionScope)
                       throws SQLException
Commit the transaction on a session

Parameters:
sessionScope - - the session
Throws:
SQLException - - if the transaction could not be committed

endTransaction

public void endTransaction(SessionScope sessionScope)
                    throws SQLException
End the transaction on a session

Parameters:
sessionScope - - the session
Throws:
SQLException - - if the transaction could not be ended

startBatch

public void startBatch(SessionScope sessionScope)
Start a batch for a session

Parameters:
sessionScope - - the session

executeBatch

public int executeBatch(SessionScope sessionScope)
                 throws SQLException
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

public List executeBatchDetailed(SessionScope sessionScope)
                          throws SQLException,
                                 BatchException
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 statements
BatchException - if the driver throws BatchUpdateException

setUserProvidedTransaction

public void setUserProvidedTransaction(SessionScope sessionScope,
                                       Connection userConnection)
Use a user-provided transaction for a session

Parameters:
sessionScope - - the session scope
userConnection - - the user supplied connection

getDataSource

public DataSource getDataSource()
Get the DataSource for the session

Returns:
- the DataSource

getSqlExecutor

public SqlExecutor getSqlExecutor()
Getter for the SqlExecutor

Returns:
the SqlExecutor

getTransaction

public Transaction getTransaction(SessionScope sessionScope)
Get a transaction for the session

Parameters:
sessionScope - - the session
Returns:
- the transaction

autoEndTransaction

protected void autoEndTransaction(SessionScope sessionScope,
                                  boolean autoStart)
                           throws SQLException
Throws:
SQLException

autoCommitTransaction

protected void autoCommitTransaction(SessionScope sessionScope,
                                     boolean autoStart)
                              throws SQLException
Throws:
SQLException

autoStartTransaction

protected Transaction autoStartTransaction(SessionScope sessionScope,
                                           boolean autoStart,
                                           Transaction trans)
                                    throws SQLException
Throws:
SQLException

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

beginStatementScope

protected StatementScope beginStatementScope(SessionScope sessionScope,
                                             MappedStatement mappedStatement)

endStatementScope

protected void endStatementScope(StatementScope statementScope)

beginSessionScope

protected SessionScope beginSessionScope()

endSessionScope

protected void endSessionScope(SessionScope sessionScope)

getResultObjectFactory

public ResultObjectFactory getResultObjectFactory()

setResultObjectFactory

public void setResultObjectFactory(ResultObjectFactory resultObjectFactory)

isStatementCacheEnabled

public boolean isStatementCacheEnabled()

setStatementCacheEnabled

public void setStatementCacheEnabled(boolean statementCacheEnabled)

isForceMultipleResultSetSupport

public boolean isForceMultipleResultSetSupport()

setForceMultipleResultSetSupport

public void setForceMultipleResultSetSupport(boolean forceMultipleResultSetSupport)


Copyright © 2010. All Rights Reserved.