Skip to content

Commit adc2f79

Browse files
committed
Removed dependency on ParameterizedRowMapper
To support Spring Framework 4.2 which removes ParameterizedRowMapper, all references to that were switched to RowMapper. As of Spring 3, the interfaces are identicle so this should cause no backward compatability issues. BATCH-2369
1 parent 63c0777 commit adc2f79

File tree

21 files changed

+84
-68
lines changed

21 files changed

+84
-68
lines changed

spring-batch-core-tests/src/main/java/org/springframework/batch/sample/domain/football/internal/PlayerSummaryMapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
import java.sql.SQLException;
2020

2121
import org.springframework.batch.core.test.football.PlayerSummary;
22-
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
22+
import org.springframework.jdbc.core.RowMapper;
2323

2424
/**
2525
* RowMapper used to map a ResultSet to a {@link PlayerSummary}
2626
*
2727
* @author Lucas Ward
2828
*
2929
*/
30-
public class PlayerSummaryMapper implements ParameterizedRowMapper<PlayerSummary> {
30+
public class PlayerSummaryMapper implements RowMapper<PlayerSummary> {
3131

3232
/* (non-Javadoc)
3333
* @see org.springframework.jdbc.core.RowMapper#mapRow(java.sql.ResultSet, int)

spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanIntegrationTests.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.junit.Before;
3333
import org.junit.Test;
3434
import org.junit.runner.RunWith;
35+
3536
import org.springframework.batch.core.BatchStatus;
3637
import org.springframework.batch.core.JobExecution;
3738
import org.springframework.batch.core.JobParameters;
@@ -45,8 +46,9 @@
4546
import org.springframework.batch.item.ParseException;
4647
import org.springframework.batch.item.UnexpectedInputException;
4748
import org.springframework.beans.factory.annotation.Autowired;
48-
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
4949
import org.springframework.jdbc.core.JdbcTemplate;
50+
import org.springframework.jdbc.core.RowMapper;
51+
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
5052
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
5153
import org.springframework.test.context.ContextConfiguration;
5254
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -213,7 +215,7 @@ public SkipWriterStub(DataSource dataSource) {
213215

214216
public List<String> getCommitted() {
215217
return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='written'",
216-
new ParameterizedRowMapper<String>() {
218+
new RowMapper<String>() {
217219
@Override
218220
public String mapRow(ResultSet rs, int rowNum) throws SQLException {
219221
return rs.getString(1);
@@ -259,7 +261,7 @@ public SkipProcessorStub(DataSource dataSource) {
259261

260262
public List<String> getCommitted() {
261263
return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='processed'",
262-
new ParameterizedRowMapper<String>() {
264+
new RowMapper<String>() {
263265
@Override
264266
public String mapRow(ResultSet rs, int rowNum) throws SQLException {
265267
return rs.getString(1);

spring-batch-core-tests/src/test/java/org/springframework/batch/core/test/step/FaultTolerantStepFactoryBeanRollbackIntegrationTests.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.junit.Before;
3636
import org.junit.Test;
3737
import org.junit.runner.RunWith;
38+
3839
import org.springframework.batch.core.BatchStatus;
3940
import org.springframework.batch.core.JobExecution;
4041
import org.springframework.batch.core.JobParameters;
@@ -48,8 +49,9 @@
4849
import org.springframework.batch.item.ParseException;
4950
import org.springframework.batch.item.UnexpectedInputException;
5051
import org.springframework.beans.factory.annotation.Autowired;
51-
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
5252
import org.springframework.jdbc.core.JdbcTemplate;
53+
import org.springframework.jdbc.core.RowMapper;
54+
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
5355
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
5456
import org.springframework.test.context.ContextConfiguration;
5557
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -238,7 +240,7 @@ public void setFailures(String... failures) {
238240

239241
public List<String> getCommitted() {
240242
return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='written'",
241-
new ParameterizedRowMapper<String>() {
243+
new RowMapper<String>() {
242244
@Override
243245
public String mapRow(ResultSet rs, int rowNum) throws SQLException {
244246
return rs.getString(1);
@@ -291,7 +293,7 @@ public List<String> getProcessed() {
291293

292294
public List<String> getCommitted() {
293295
return jdbcTemplate.query("SELECT MESSAGE from ERROR_LOG where STEP_NAME='processed'",
294-
new ParameterizedRowMapper<String>() {
296+
new RowMapper<String>() {
295297
@Override
296298
public String mapRow(ResultSet rs, int rowNum) throws SQLException {
297299
return rs.getString(1);

spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDao.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import org.springframework.core.serializer.Serializer;
3737
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
3838
import org.springframework.jdbc.core.PreparedStatementSetter;
39-
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
39+
import org.springframework.jdbc.core.RowMapper;
4040
import org.springframework.jdbc.support.lob.DefaultLobHandler;
4141
import org.springframework.jdbc.support.lob.LobHandler;
4242
import org.springframework.util.Assert;
@@ -306,7 +306,7 @@ private String serializeContext(ExecutionContext ctx) {
306306
return results;
307307
}
308308

309-
private class ExecutionContextRowMapper implements ParameterizedRowMapper<ExecutionContext> {
309+
private class ExecutionContextRowMapper implements RowMapper<ExecutionContext> {
310310

311311
@Override
312312
public ExecutionContext mapRow(ResultSet rs, int i) throws SQLException {

spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobExecutionDao.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import org.apache.commons.logging.Log;
3131
import org.apache.commons.logging.LogFactory;
32+
3233
import org.springframework.batch.core.BatchStatus;
3334
import org.springframework.batch.core.ExitStatus;
3435
import org.springframework.batch.core.JobExecution;
@@ -40,7 +41,7 @@
4041
import org.springframework.dao.EmptyResultDataAccessException;
4142
import org.springframework.dao.OptimisticLockingFailureException;
4243
import org.springframework.jdbc.core.RowCallbackHandler;
43-
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
44+
import org.springframework.jdbc.core.RowMapper;
4445
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
4546
import org.springframework.util.Assert;
4647

@@ -390,7 +391,7 @@ public void processRow(ResultSet rs) throws SQLException {
390391
* @author Dave Syer
391392
*
392393
*/
393-
private final class JobExecutionRowMapper implements ParameterizedRowMapper<JobExecution> {
394+
private final class JobExecutionRowMapper implements RowMapper<JobExecution> {
394395

395396
private JobInstance jobInstance;
396397

spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcJobInstanceDao.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.springframework.dao.DataAccessException;
3333
import org.springframework.dao.EmptyResultDataAccessException;
3434
import org.springframework.jdbc.core.ResultSetExtractor;
35+
import org.springframework.jdbc.core.RowMapper;
3536
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
3637
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
3738
import org.springframework.util.Assert;
@@ -138,7 +139,7 @@ public JobInstance getJobInstance(final String jobName,
138139

139140
String jobKey = jobKeyGenerator.generateKey(jobParameters);
140141

141-
ParameterizedRowMapper<JobInstance> rowMapper = new JobInstanceRowMapper();
142+
RowMapper<JobInstance> rowMapper = new JobInstanceRowMapper();
142143

143144
List<JobInstance> instances;
144145
if (StringUtils.hasLength(jobKey)) {
@@ -218,7 +219,7 @@ public List<JobInstance> extractData(ResultSet rs) throws SQLException,
218219
rowNum++;
219220
}
220221
while (rowNum < start + count && rs.next()) {
221-
ParameterizedRowMapper<JobInstance> rowMapper = new JobInstanceRowMapper();
222+
RowMapper<JobInstance> rowMapper = new JobInstanceRowMapper();
222223
list.add(rowMapper.mapRow(rs, rowNum));
223224
rowNum++;
224225
}
@@ -289,8 +290,7 @@ public void afterPropertiesSet() throws Exception {
289290
* @author Dave Syer
290291
*
291292
*/
292-
private final class JobInstanceRowMapper implements
293-
ParameterizedRowMapper<JobInstance> {
293+
private final class JobInstanceRowMapper implements RowMapper<JobInstance> {
294294

295295
public JobInstanceRowMapper() {
296296
}
@@ -318,7 +318,7 @@ public Object extractData(ResultSet rs) throws SQLException,
318318
rowNum++;
319319
}
320320
while (rowNum < start + count && rs.next()) {
321-
ParameterizedRowMapper<JobInstance> rowMapper = new JobInstanceRowMapper();
321+
RowMapper<JobInstance> rowMapper = new JobInstanceRowMapper();
322322
list.add(rowMapper.mapRow(rs, rowNum));
323323
rowNum++;
324324
}

spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDao.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,31 @@
1616

1717
package org.springframework.batch.core.repository.dao;
1818

19+
import java.sql.PreparedStatement;
20+
import java.sql.ResultSet;
21+
import java.sql.SQLException;
22+
import java.sql.Timestamp;
23+
import java.sql.Types;
24+
import java.util.ArrayList;
25+
import java.util.Arrays;
26+
import java.util.Collection;
27+
import java.util.Iterator;
28+
import java.util.List;
29+
1930
import org.apache.commons.logging.Log;
2031
import org.apache.commons.logging.LogFactory;
32+
2133
import org.springframework.batch.core.BatchStatus;
2234
import org.springframework.batch.core.ExitStatus;
2335
import org.springframework.batch.core.JobExecution;
2436
import org.springframework.batch.core.StepExecution;
2537
import org.springframework.beans.factory.InitializingBean;
2638
import org.springframework.dao.OptimisticLockingFailureException;
2739
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
28-
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
40+
import org.springframework.jdbc.core.RowMapper;
2941
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
3042
import org.springframework.util.Assert;
3143

32-
import java.sql.PreparedStatement;
33-
import java.sql.ResultSet;
34-
import java.sql.SQLException;
35-
import java.sql.Timestamp;
36-
import java.sql.Types;
37-
import java.util.ArrayList;
38-
import java.util.Arrays;
39-
import java.util.Collection;
40-
import java.util.Iterator;
41-
import java.util.List;
42-
4344
/**
4445
* JDBC implementation of {@link StepExecutionDao}.<br>
4546
*
@@ -297,7 +298,7 @@ public void addStepExecutions(JobExecution jobExecution) {
297298
jobExecution.getId());
298299
}
299300

300-
private static class StepExecutionRowMapper implements ParameterizedRowMapper<StepExecution> {
301+
private static class StepExecutionRowMapper implements RowMapper<StepExecution> {
301302

302303
private final JobExecution jobExecution;
303304

spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JdbcPagingItemReaderAsyncTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,16 @@
4040
import org.junit.Before;
4141
import org.junit.Test;
4242
import org.junit.runner.RunWith;
43+
4344
import org.springframework.batch.item.ItemReader;
4445
import org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean;
4546
import org.springframework.batch.item.sample.Foo;
46-
import org.springframework.test.jdbc.JdbcTestUtils;
4747
import org.springframework.beans.factory.annotation.Autowired;
4848
import org.springframework.jdbc.core.JdbcTemplate;
49-
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
49+
import org.springframework.jdbc.core.RowMapper;
5050
import org.springframework.test.context.ContextConfiguration;
5151
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
52+
import org.springframework.test.jdbc.JdbcTestUtils;
5253

5354
/**
5455
* @author Dave Syer
@@ -168,7 +169,7 @@ protected ItemReader<Foo> getItemReader() throws Exception {
168169
sortKeys.put("VALUE", Order.ASCENDING);
169170
factory.setSortKeys(sortKeys);
170171
reader.setQueryProvider(factory.getObject());
171-
reader.setRowMapper(new ParameterizedRowMapper<Foo>() {
172+
reader.setRowMapper(new RowMapper<Foo>() {
172173
@Override
173174
public Foo mapRow(ResultSet rs, int i) throws SQLException {
174175
Foo foo = new Foo();

spring-batch-infrastructure-tests/src/test/java/org/springframework/batch/item/database/JdbcPagingRestartIntegrationTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@
3535
import org.junit.Ignore;
3636
import org.junit.Test;
3737
import org.junit.runner.RunWith;
38+
3839
import org.springframework.batch.item.ExecutionContext;
3940
import org.springframework.batch.item.ItemReader;
4041
import org.springframework.batch.item.ItemStream;
4142
import org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean;
4243
import org.springframework.batch.item.sample.Foo;
4344
import org.springframework.beans.factory.annotation.Autowired;
4445
import org.springframework.jdbc.core.JdbcTemplate;
45-
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
46+
import org.springframework.jdbc.core.RowMapper;
4647
import org.springframework.test.context.ContextConfiguration;
4748
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
4849
import org.springframework.test.jdbc.JdbcTestUtils;
@@ -159,7 +160,7 @@ protected ItemReader<Foo> getItemReader() throws Exception {
159160
sortKeys.put("VALUE", Order.ASCENDING);
160161
factory.setSortKeys(sortKeys);
161162
reader.setQueryProvider(factory.getObject());
162-
reader.setRowMapper(new ParameterizedRowMapper<Foo>() {
163+
reader.setRowMapper(new RowMapper<Foo>() {
163164
@Override
164165
public Foo mapRow(ResultSet rs, int i) throws SQLException {
165166
Foo foo = new Foo();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void setQueryProvider(PagingQueryProvider queryProvider) {
135135
* by the reader.
136136
*
137137
* @param rowMapper a
138-
* {@link org.springframework.jdbc.core.simple.ParameterizedRowMapper}
138+
* {@link RowMapper}
139139
* implementation
140140
*/
141141
public void setRowMapper(RowMapper<T> rowMapper) {

0 commit comments

Comments
 (0)