Skip to content

Commit b13ed76

Browse files
committed
refactor to make code more readable
1 parent 7dde13f commit b13ed76

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/org/apache/ibatis/executor/CachingExecutor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ public Transaction getTransaction() {
5454

5555
public void close(boolean forceRollback) {
5656
try {
57-
if (dirty) { //issue #499. Unresolved session handling
57+
//issue #499. Unresolved session handling
58+
//issue #573. Autocommit sessions should commit
59+
if (dirty && !autoCommit) {
5860
tcm.rollback();
5961
} else {
6062
tcm.commit();
@@ -155,7 +157,7 @@ private void flushCacheIfRequired(MappedStatement ms) {
155157
Cache cache = ms.getCache();
156158
if (cache != null) {
157159
if (ms.isFlushCacheRequired()) {
158-
if (!autoCommit) dirty = true; // issue #524. Disable using cached data for this session
160+
dirty = true; // issue #524. Disable using cached data for this session
159161
tcm.clear(cache);
160162
}
161163
}

0 commit comments

Comments
 (0)