Skip to content

Commit 67e3990

Browse files
parikshitduttafmbenhassine
authored andcommitted
Updated verifyCursorPosition default to true in JdbcCursorItemReaderBuilder
Issue #3893
1 parent df7f831 commit 67e3990

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/builder/JdbcCursorItemReaderBuilder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2020 the original author or authors.
2+
* Copyright 2016-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@
3636
* @author Drummond Dawson
3737
* @author Mahmoud Ben Hassine
3838
* @author Ankur Trapasiya
39+
* @author Parikshit Dutta
3940
* @since 4.0
4041
*/
4142
public class JdbcCursorItemReaderBuilder<T> {
@@ -50,7 +51,7 @@ public class JdbcCursorItemReaderBuilder<T> {
5051

5152
private boolean ignoreWarnings;
5253

53-
private boolean verifyCursorPosition;
54+
private boolean verifyCursorPosition = true;
5455

5556
private boolean driverSupportsAbsolute;
5657

spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/builder/JdbcCursorItemReaderBuilderTests.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2020 the original author or authors.
2+
* Copyright 2016-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -48,6 +48,7 @@
4848
* @author Michael Minella
4949
* @author Drummond Dawson
5050
* @author Ankur Trapasiya
51+
* @author Parikshit Dutta
5152
*/
5253
public class JdbcCursorItemReaderBuilderTests {
5354

@@ -314,6 +315,17 @@ public void testOtherProperties() {
314315
assertTrue((boolean) ReflectionTestUtils.getField(reader, "connectionAutoCommit"));
315316
}
316317

318+
@Test
319+
public void testVerifyCursorPositionDefaultToTrue() {
320+
JdbcCursorItemReader<Foo> reader = new JdbcCursorItemReaderBuilder<Foo>()
321+
.dataSource(this.dataSource)
322+
.name("fooReader")
323+
.sql("SELECT * FROM FOO ORDER BY FIRST")
324+
.beanRowMapper(Foo.class)
325+
.build();
326+
assertTrue((boolean) ReflectionTestUtils.getField(reader, "verifyCursorPosition"));
327+
}
328+
317329
@Test
318330
public void testValidation() {
319331
try {

0 commit comments

Comments
 (0)