diff --git a/infrastructure/src/main/java/org/springframework/batch/io/sql/CompositeKeySqlDrivingQueryInputSource.java b/infrastructure/src/main/java/org/springframework/batch/io/sql/CompositeKeySqlDrivingQueryInputSource.java index 9d0da27ed..c17fe6c2b 100644 --- a/infrastructure/src/main/java/org/springframework/batch/io/sql/CompositeKeySqlDrivingQueryInputSource.java +++ b/infrastructure/src/main/java/org/springframework/batch/io/sql/CompositeKeySqlDrivingQueryInputSource.java @@ -20,6 +20,7 @@ import java.util.List; import org.springframework.batch.io.support.AbstractDrivingQueryInputSource; import org.springframework.batch.restart.RestartData; +import org.springframework.jdbc.core.ColumnMapRowMapper; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import org.springframework.util.Assert; @@ -42,13 +43,13 @@ public class CompositeKeySqlDrivingQueryInputSource extends private JdbcTemplate jdbcTemplate; - private RowMapper keyMapper; + private RowMapper keyMapper = new ColumnMapRowMapper(); private String drivingQuery; private String restartQuery; - private CompositeKeyRestartDataConverter restartDataConverter; + private RestartDataConverter restartDataConverter; public CompositeKeySqlDrivingQueryInputSource() { super(); @@ -110,7 +111,7 @@ public class CompositeKeySqlDrivingQueryInputSource extends * @param restartDataConverter */ public void setRestartDataConverter( - CompositeKeyRestartDataConverter restartDataConverter) { + RestartDataConverter restartDataConverter) { this.restartDataConverter = restartDataConverter; } @@ -130,6 +131,5 @@ public class CompositeKeySqlDrivingQueryInputSource extends public void afterPropertiesSet() throws Exception { Assert.notNull(jdbcTemplate, "The JdbcTemplate must not be null."); Assert.hasText(drivingQuery, "The DrivingQuery must not be null or empty."); - Assert.notNull(keyMapper, "The key RowMapper must not be null."); } } diff --git a/infrastructure/src/main/java/org/springframework/batch/io/sql/CompositeKeyRestartDataConverter.java b/infrastructure/src/main/java/org/springframework/batch/io/sql/RestartDataConverter.java similarity index 93% rename from infrastructure/src/main/java/org/springframework/batch/io/sql/CompositeKeyRestartDataConverter.java rename to infrastructure/src/main/java/org/springframework/batch/io/sql/RestartDataConverter.java index b8099363b..742a70fed 100644 --- a/infrastructure/src/main/java/org/springframework/batch/io/sql/CompositeKeyRestartDataConverter.java +++ b/infrastructure/src/main/java/org/springframework/batch/io/sql/RestartDataConverter.java @@ -24,7 +24,7 @@ import org.springframework.batch.restart.RestartData; * @author Lucas Ward * */ -public interface CompositeKeyRestartDataConverter { +public interface RestartDataConverter { /** * Given the provided composite key, return a RestartData representation. diff --git a/infrastructure/src/test/java/org/springframework/batch/io/sql/CompositeKeySqlDrivingQueryInputSourceIntegrationTests.java b/infrastructure/src/test/java/org/springframework/batch/io/sql/CompositeKeySqlDrivingQueryInputSourceIntegrationTests.java index 99f56afce..4d4cfb5b0 100644 --- a/infrastructure/src/test/java/org/springframework/batch/io/sql/CompositeKeySqlDrivingQueryInputSourceIntegrationTests.java +++ b/infrastructure/src/test/java/org/springframework/batch/io/sql/CompositeKeySqlDrivingQueryInputSourceIntegrationTests.java @@ -47,7 +47,7 @@ public class CompositeKeySqlDrivingQueryInputSourceIntegrationTests extends return fooInputSource; } - private static class FooRestartDataConverter implements CompositeKeyRestartDataConverter{ + private static class FooRestartDataConverter implements RestartDataConverter{ private static final String ID_RESTART_KEY = "FooRestartDataConverter.id"; private static final String VALUE_RESTART_KEY = "FooRestartDataConverter.value";