Skip to content

Commit c600674

Browse files
committed
Improve handling of defaultStatementTimeout #503
1 parent f3f6cb6 commit c600674

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

src/main/java/org/apache/ibatis/builder/MapperBuilderAssistant.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ public MappedStatement addMappedStatement(
282282
MappedStatement.Builder statementBuilder = new MappedStatement.Builder(configuration, id, sqlSource, sqlCommandType);
283283
statementBuilder.resource(resource);
284284
statementBuilder.fetchSize(fetchSize);
285+
statementBuilder.timeout(timeout);
285286
statementBuilder.statementType(statementType);
286287
statementBuilder.keyGenerator(keyGenerator);
287288
statementBuilder.keyProperty(keyProperty);
@@ -290,7 +291,6 @@ public MappedStatement addMappedStatement(
290291
statementBuilder.lang(lang);
291292
statementBuilder.resultOrdered(resultOrdered);
292293
statementBuilder.resulSets(resultSets);
293-
setStatementTimeout(timeout, statementBuilder);
294294

295295
setStatementParameterMap(parameterMap, parameterType, statementBuilder);
296296
setStatementResultMap(resultMap, resultType, resultSetType, statementBuilder);
@@ -372,13 +372,6 @@ private void setStatementResultMap(
372372
statementBuilder.resultSetType(resultSetType);
373373
}
374374

375-
private void setStatementTimeout(Integer timeout, MappedStatement.Builder statementBuilder) {
376-
if (timeout == null) {
377-
timeout = configuration.getDefaultStatementTimeout();
378-
}
379-
statementBuilder.timeout(timeout);
380-
}
381-
382375
public ResultMapping buildResultMapping(
383376
Class<?> resultType,
384377
String property,

src/main/java/org/apache/ibatis/mapping/MappedStatement.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public Builder(Configuration configuration, String id, SqlSource sqlSource, SqlC
7171
mappedStatement.statementType = StatementType.PREPARED;
7272
mappedStatement.parameterMap = new ParameterMap.Builder(configuration, "defaultParameterMap", null, new ArrayList<ParameterMapping>()).build();
7373
mappedStatement.resultMaps = new ArrayList<ResultMap>();
74-
mappedStatement.timeout = configuration.getDefaultStatementTimeout();
7574
mappedStatement.sqlCommandType = sqlCommandType;
7675
mappedStatement.keyGenerator = configuration.isUseGeneratedKeys() && SqlCommandType.INSERT.equals(sqlCommandType) ? new Jdbc3KeyGenerator() : new NoKeyGenerator();
7776
String logId = id;

src/test/java/org/apache/ibatis/executor/ExecutorTestHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public static MappedStatement prepareSelectAllAuthorsAutoMappedStatement(final C
197197
}
198198
}).build());
199199
}
200-
}).fetchSize(1000).build();
200+
}).fetchSize(1000).timeout(2000).build();
201201
}
202202

203203
public static MappedStatement prepareSelectOneAuthorMappedStatementWithConstructorResults(final Configuration config) {

0 commit comments

Comments
 (0)