Package org.apache.ibatis.executor
Class BaseExecutor
- java.lang.Object
-
- org.apache.ibatis.executor.BaseExecutor
-
- All Implemented Interfaces:
Executor
- Direct Known Subclasses:
BatchExecutor
,ReuseExecutor
,SimpleExecutor
public abstract class BaseExecutor extends java.lang.Object implements Executor
- Author:
- Clinton Begin
-
-
Field Summary
Fields Modifier and Type Field Description protected Configuration
configuration
protected java.util.concurrent.ConcurrentLinkedQueue<org.apache.ibatis.executor.BaseExecutor.DeferredLoad>
deferredLoads
protected PerpetualCache
localCache
protected PerpetualCache
localOutputParameterCache
protected int
queryStack
protected Transaction
transaction
protected Executor
wrapper
-
Fields inherited from interface org.apache.ibatis.executor.Executor
NO_RESULT_HANDLER
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseExecutor(Configuration configuration, Transaction transaction)
-
Method Summary
Modifier and Type Method Description protected void
applyTransactionTimeout(java.sql.Statement statement)
Apply a transaction timeout.void
clearLocalCache()
void
close(boolean forceRollback)
protected void
closeStatement(java.sql.Statement statement)
void
commit(boolean required)
CacheKey
createCacheKey(MappedStatement ms, java.lang.Object parameterObject, RowBounds rowBounds, BoundSql boundSql)
void
deferLoad(MappedStatement ms, MetaObject resultObject, java.lang.String property, CacheKey key, java.lang.Class<?> targetType)
protected abstract java.util.List<BatchResult>
doFlushStatements(boolean isRollback)
protected abstract <E> java.util.List<E>
doQuery(MappedStatement ms, java.lang.Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql)
protected abstract <E> Cursor<E>
doQueryCursor(MappedStatement ms, java.lang.Object parameter, RowBounds rowBounds, BoundSql boundSql)
protected abstract int
doUpdate(MappedStatement ms, java.lang.Object parameter)
java.util.List<BatchResult>
flushStatements()
java.util.List<BatchResult>
flushStatements(boolean isRollBack)
protected java.sql.Connection
getConnection(Log statementLog)
Transaction
getTransaction()
boolean
isCached(MappedStatement ms, CacheKey key)
boolean
isClosed()
<E> java.util.List<E>
query(MappedStatement ms, java.lang.Object parameter, RowBounds rowBounds, ResultHandler resultHandler)
<E> java.util.List<E>
query(MappedStatement ms, java.lang.Object parameter, RowBounds rowBounds, ResultHandler resultHandler, CacheKey key, BoundSql boundSql)
<E> Cursor<E>
queryCursor(MappedStatement ms, java.lang.Object parameter, RowBounds rowBounds)
void
rollback(boolean required)
void
setExecutorWrapper(Executor wrapper)
int
update(MappedStatement ms, java.lang.Object parameter)
-
-
-
Field Detail
-
transaction
protected Transaction transaction
-
wrapper
protected Executor wrapper
-
deferredLoads
protected java.util.concurrent.ConcurrentLinkedQueue<org.apache.ibatis.executor.BaseExecutor.DeferredLoad> deferredLoads
-
localCache
protected PerpetualCache localCache
-
localOutputParameterCache
protected PerpetualCache localOutputParameterCache
-
configuration
protected Configuration configuration
-
queryStack
protected int queryStack
-
-
Constructor Detail
-
BaseExecutor
protected BaseExecutor(Configuration configuration, Transaction transaction)
-
-
Method Detail
-
getTransaction
public Transaction getTransaction()
- Specified by:
getTransaction
in interfaceExecutor
-
update
public int update(MappedStatement ms, java.lang.Object parameter) throws java.sql.SQLException
-
flushStatements
public java.util.List<BatchResult> flushStatements() throws java.sql.SQLException
- Specified by:
flushStatements
in interfaceExecutor
- Throws:
java.sql.SQLException
-
flushStatements
public java.util.List<BatchResult> flushStatements(boolean isRollBack) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
query
public <E> java.util.List<E> query(MappedStatement ms, java.lang.Object parameter, RowBounds rowBounds, ResultHandler resultHandler) throws java.sql.SQLException
-
query
public <E> java.util.List<E> query(MappedStatement ms, java.lang.Object parameter, RowBounds rowBounds, ResultHandler resultHandler, CacheKey key, BoundSql boundSql) throws java.sql.SQLException
-
queryCursor
public <E> Cursor<E> queryCursor(MappedStatement ms, java.lang.Object parameter, RowBounds rowBounds) throws java.sql.SQLException
- Specified by:
queryCursor
in interfaceExecutor
- Throws:
java.sql.SQLException
-
deferLoad
public void deferLoad(MappedStatement ms, MetaObject resultObject, java.lang.String property, CacheKey key, java.lang.Class<?> targetType)
-
createCacheKey
public CacheKey createCacheKey(MappedStatement ms, java.lang.Object parameterObject, RowBounds rowBounds, BoundSql boundSql)
- Specified by:
createCacheKey
in interfaceExecutor
-
isCached
public boolean isCached(MappedStatement ms, CacheKey key)
-
commit
public void commit(boolean required) throws java.sql.SQLException
-
rollback
public void rollback(boolean required) throws java.sql.SQLException
-
clearLocalCache
public void clearLocalCache()
- Specified by:
clearLocalCache
in interfaceExecutor
-
doUpdate
protected abstract int doUpdate(MappedStatement ms, java.lang.Object parameter) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
doFlushStatements
protected abstract java.util.List<BatchResult> doFlushStatements(boolean isRollback) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
doQuery
protected abstract <E> java.util.List<E> doQuery(MappedStatement ms, java.lang.Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
doQueryCursor
protected abstract <E> Cursor<E> doQueryCursor(MappedStatement ms, java.lang.Object parameter, RowBounds rowBounds, BoundSql boundSql) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
closeStatement
protected void closeStatement(java.sql.Statement statement)
-
applyTransactionTimeout
protected void applyTransactionTimeout(java.sql.Statement statement) throws java.sql.SQLException
Apply a transaction timeout.- Parameters:
statement
- a current statement- Throws:
java.sql.SQLException
- if a database access error occurs, this method is called on a closedStatement
- Since:
- 3.4.0
- See Also:
StatementUtil.applyTransactionTimeout(Statement, Integer, Integer)
-
getConnection
protected java.sql.Connection getConnection(Log statementLog) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
setExecutorWrapper
public void setExecutorWrapper(Executor wrapper)
- Specified by:
setExecutorWrapper
in interfaceExecutor
-
-