コード例 #1
0
ファイル: BaseExecutor.java プロジェクト: lhw209/half-cms
 public int update(MappedStatement ms, Object parameter) throws SQLException {
   ErrorContext.instance()
       .resource(ms.getResource())
       .activity("executing an update")
       .object(ms.getId());
   if (closed) throw new ExecutorException("Executor was closed.");
   clearLocalCache();
   return doUpdate(ms, parameter);
 }
コード例 #2
0
ファイル: BaseExecutor.java プロジェクト: lhw209/half-cms
 @SuppressWarnings("unchecked")
 public <E> List<E> query(
     MappedStatement ms,
     Object parameter,
     RowBounds rowBounds,
     ResultHandler resultHandler,
     CacheKey key,
     BoundSql boundSql)
     throws SQLException {
   ErrorContext.instance()
       .resource(ms.getResource())
       .activity("executing a query")
       .object(ms.getId());
   if (closed) throw new ExecutorException("Executor was closed.");
   if (queryStack == 0 && ms.isFlushCacheRequired()) {
     clearLocalCache();
   }
   List<E> list;
   try {
     queryStack++;
     list = resultHandler == null ? (List<E>) localCache.getObject(key) : null;
     if (list != null) {
       handleLocallyCachedOutputParameters(ms, key, parameter, boundSql);
     } else {
       list = queryFromDatabase(ms, parameter, rowBounds, resultHandler, key, boundSql);
     }
   } finally {
     queryStack--;
   }
   if (queryStack == 0) {
     for (DeferredLoad deferredLoad : deferredLoads) {
       deferredLoad.load();
     }
     if (configuration.getLocalCacheScope() == LocalCacheScope.STATEMENT) {
       clearLocalCache(); // issue #482
     }
   }
   return list;
 }