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
This commit is contained in:
Michael Minella
2015-03-31 14:06:10 -05:00
parent 4c72e0407f
commit 7c60b055c3
21 changed files with 85 additions and 69 deletions

View File

@@ -25,6 +25,7 @@ import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.StepExecutionListener;
@@ -34,7 +35,7 @@ import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.util.Assert;
import org.springframework.util.SerializationUtils;
@@ -82,7 +83,7 @@ InitializingBean, DisposableBean {
"SELECT ID FROM BATCH_STAGING WHERE JOB_ID=? AND PROCESSED=? ORDER BY ID",
new ParameterizedRowMapper<Long>() {
new RowMapper<Long>() {
@Override
public Long mapRow(ResultSet rs, int rowNum) throws SQLException {
return rs.getLong(1);
@@ -114,7 +115,7 @@ InitializingBean, DisposableBean {
}
@SuppressWarnings("unchecked")
T result = (T) jdbcTemplate.queryForObject("SELECT VALUE FROM BATCH_STAGING WHERE ID=?",
new ParameterizedRowMapper<Object>() {
new RowMapper<Object>() {
@Override
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
byte[] blob = rs.getBytes(1);

View File

@@ -19,7 +19,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.batch.sample.domain.football.PlayerSummary;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.jdbc.core.RowMapper;
/**
* RowMapper used to map a ResultSet to a {@link PlayerSummary}
@@ -27,7 +27,7 @@ import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
* @author Lucas Ward
*
*/
public class PlayerSummaryMapper implements ParameterizedRowMapper<PlayerSummary> {
public class PlayerSummaryMapper implements RowMapper<PlayerSummary> {
/* (non-Javadoc)
* @see org.springframework.jdbc.core.RowMapper#mapRow(java.sql.ResultSet, int)

View File

@@ -28,6 +28,7 @@ import javax.sql.DataSource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.sample.domain.trade.internal.CustomerCreditIncreaseProcessor;
@@ -38,7 +39,7 @@ import org.springframework.jdbc.UncategorizedSQLException;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowCallbackHandler;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.orm.hibernate3.HibernateJdbcException;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -121,7 +122,7 @@ public class HibernateFailureJobFunctionalTests {
creditsBeforeUpdate = new TransactionTemplate(transactionManager).execute(new TransactionCallback<List<BigDecimal>>() {
@Override
public List<BigDecimal> doInTransaction(TransactionStatus status) {
return jdbcTemplate.query(ALL_CUSTOMERS, new ParameterizedRowMapper<BigDecimal>() {
return jdbcTemplate.query(ALL_CUSTOMERS, new RowMapper<BigDecimal>() {
@Override
public BigDecimal mapRow(ResultSet rs, int rowNum) throws SQLException {
return rs.getBigDecimal(CREDIT_COLUMN);

View File

@@ -26,11 +26,12 @@ import javax.sql.DataSource;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.batch.sample.domain.football.Game;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
@@ -82,7 +83,7 @@ public class JdbcGameDaoIntegrationTests {
assertEquals(tempGame, game);
}
private static class GameRowMapper implements ParameterizedRowMapper<Game> {
private static class GameRowMapper implements RowMapper<Game> {
@Override
public Game mapRow(ResultSet rs, int arg1) throws SQLException {
if (rs == null) {