Class SqlMapExecutorDelegate

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

public class SqlMapExecutorDelegate extends Object
The workhorse that really runs the SQL.
  • Field Details

    • sqlExecutor

      protected SqlExecutor sqlExecutor
      The sql executor.
  • Constructor Details

    • SqlMapExecutorDelegate

      public SqlMapExecutorDelegate()
      Default constructor.
  • Method Details

    • setCustomExecutor

      public void setCustomExecutor(String sqlExecutorClass)
      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

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

      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
      transactionIsolation - the transaction isolation
      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
      Auto end transaction.
      Parameters:
      sessionScope - the session scope
      autoStart - 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 scope
      autoStart - 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 scope
      autoStart - the auto start
      trans - the trans
      Returns:
      the transaction
      Throws:
      SQLException - the SQL exception
    • 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)
      Begin statement scope.
      Parameters:
      sessionScope - the session scope
      mappedStatement - the mapped statement
      Returns:
      the statement scope
    • endStatementScope

      protected void endStatementScope(StatementScope statementScope)
      End statement scope.
      Parameters:
      statementScope - the statement scope
    • beginSessionScope

      protected SessionScope beginSessionScope()
      Begin session scope.
      Returns:
      the session scope
    • endSessionScope

      protected void endSessionScope(SessionScope sessionScope)
      End session scope.
      Parameters:
      sessionScope - the session scope
    • getResultObjectFactory

      public ResultObjectFactory getResultObjectFactory()
      Gets the result object factory.
      Returns:
      the result object factory
    • setResultObjectFactory

      public void setResultObjectFactory(ResultObjectFactory resultObjectFactory)
      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