Skip to content

Commit ccc51e6

Browse files
author
Julien KLAER
committed
fix(paging item reader): Staying simple and and passing
all tests locally.
1 parent 9749d2d commit ccc51e6

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/main/java/org/mybatis/spring/batch/MyBatisPagingItemReader.java

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,22 +92,11 @@ public void afterPropertiesSet() throws Exception {
9292
notNull(queryId, "A queryId is required.");
9393
}
9494

95-
@Override
96-
protected void doOpen() throws Exception {
97-
super.doOpen();
98-
sqlSessionTemplate = new SqlSessionTemplate(sqlSessionFactory, ExecutorType.BATCH);
99-
}
100-
101-
@Override
102-
protected void doClose() throws Exception {
103-
if (sqlSessionTemplate != null) {
104-
sqlSessionTemplate.close();
105-
}
106-
super.doClose();
107-
}
108-
10995
@Override
11096
protected void doReadPage() {
97+
if (sqlSessionTemplate == null) {
98+
sqlSessionTemplate = new SqlSessionTemplate(sqlSessionFactory, ExecutorType.BATCH);
99+
}
111100
Map<String, Object> parameters = new HashMap<>();
112101
if (parameterValues != null) {
113102
parameters.putAll(parameterValues);

0 commit comments

Comments
 (0)