Skip to content

Commit 2b929b5

Browse files
committed
Polishing handling of timeout and defaultStatementTimeout #503
1 parent c600674 commit 2b929b5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/org/apache/ibatis/executor/statement/BaseStatementHandler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,12 @@ public Statement prepare(Connection connection) throws SQLException {
102102

103103
protected void setStatementTimeout(Statement stmt) throws SQLException {
104104
Integer timeout = mappedStatement.getTimeout();
105-
Integer defaultTimeout = configuration.getDefaultStatementTimeout();
106105
if (timeout != null) {
107106
stmt.setQueryTimeout(timeout);
108-
} else if (defaultTimeout != null) {
107+
return;
108+
}
109+
Integer defaultTimeout = configuration.getDefaultStatementTimeout();
110+
if (defaultTimeout != null) {
109111
stmt.setQueryTimeout(defaultTimeout);
110112
}
111113
}

0 commit comments

Comments
 (0)