diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/JdbcTestUtils.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/JdbcTestUtils.java
index ecf99bf28..4662f2fec 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/JdbcTestUtils.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/JdbcTestUtils.java
@@ -2,7 +2,7 @@ package org.springframework.batch.support;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.JdbcOperations;
/**
*
@@ -25,7 +25,7 @@ public final class JdbcTestUtils {
* @param tableName table name to count rows in
* @return the number of rows in the table
*/
- public static int countRowsInTable(JdbcTemplate jdbcTemplate, String tableName) {
+ public static int countRowsInTable(JdbcOperations jdbcTemplate, String tableName) {
return jdbcTemplate.queryForInt("SELECT COUNT(0) FROM " + tableName);
}
@@ -35,7 +35,7 @@ public final class JdbcTestUtils {
* @param tableNames the names of the tables from which to delete
* @return the total number of rows deleted from all specified tables
*/
- public static int deleteFromTables(JdbcTemplate jdbcTemplate, String... tableNames) {
+ public static int deleteFromTables(JdbcOperations jdbcTemplate, String... tableNames) {
int totalRowCount = 0;
for (String tableName : tableNames) {
int rowCount = jdbcTemplate.update("DELETE FROM " + tableName);
diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/ColumnRangePartitioner.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/ColumnRangePartitioner.java
index 283b37071..dd9c11e6e 100644
--- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/ColumnRangePartitioner.java
+++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/ColumnRangePartitioner.java
@@ -7,19 +7,20 @@ import javax.sql.DataSource;
import org.springframework.batch.core.partition.support.Partitioner;
import org.springframework.batch.item.ExecutionContext;
-import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
+import org.springframework.jdbc.core.JdbcOperations;
+import org.springframework.jdbc.core.JdbcTemplate;
/**
* Simple minded partitioner for a range of values of a column in a database
* table. Works best if the values are uniformly distributed (e.g.
* auto-generated primary key values).
- *
+ *
* @author Dave Syer
- *
+ *
*/
public class ColumnRangePartitioner implements Partitioner {
- private SimpleJdbcTemplate jdbcTemplate;
+ private JdbcOperations jdbcTemplate;
private String table;
@@ -27,7 +28,7 @@ public class ColumnRangePartitioner implements Partitioner {
/**
* The name of the SQL table the data are in.
- *
+ *
* @param table the name of the table
*/
public void setTable(String table) {
@@ -36,7 +37,7 @@ public class ColumnRangePartitioner implements Partitioner {
/**
* The name of the column to partition.
- *
+ *
* @param column the column name.
*/
public void setColumn(String column) {
@@ -45,11 +46,11 @@ public class ColumnRangePartitioner implements Partitioner {
/**
* The data source for connecting to the database.
- *
+ *
* @param dataSource a {@link DataSource}
*/
public void setDataSource(DataSource dataSource) {
- jdbcTemplate = new SimpleJdbcTemplate(dataSource);
+ jdbcTemplate = new JdbcTemplate(dataSource);
}
/**
@@ -57,7 +58,7 @@ public class ColumnRangePartitioner implements Partitioner {
* are uniformly distributed. The execution context values will have keys
* minValue and maxValue specifying the range of
* values to consider in each partition.
- *
+ *
* @see Partitioner#partition(int)
*/
public Map partition(int gridSize) {
diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemListener.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemListener.java
index c7c6fe96f..e4012611b 100644
--- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemListener.java
+++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2007 the original author or authors.
+ * Copyright 2006-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,8 @@ import org.springframework.batch.core.listener.StepListenerSupport;
import org.springframework.batch.item.ItemReader;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.dao.OptimisticLockingFailureException;
-import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
+import org.springframework.jdbc.core.JdbcOperations;
+import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.Assert;
/**
@@ -31,10 +32,10 @@ import org.springframework.util.Assert;
*/
public class StagingItemListener extends StepListenerSupport implements InitializingBean {
- private SimpleJdbcTemplate jdbcTemplate;
+ private JdbcOperations jdbcTemplate;
public void setDataSource(DataSource dataSource) {
- jdbcTemplate = new SimpleJdbcTemplate(dataSource);
+ jdbcTemplate = new JdbcTemplate(dataSource);
}
public final void afterPropertiesSet() throws Exception {
diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemProcessor.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemProcessor.java
index ccf23b233..3bf84b234 100644
--- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemProcessor.java
+++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemProcessor.java
@@ -5,32 +5,32 @@ import javax.sql.DataSource;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.dao.OptimisticLockingFailureException;
-import org.springframework.jdbc.core.simple.SimpleJdbcOperations;
-import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
+import org.springframework.jdbc.core.JdbcOperations;
+import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.Assert;
/**
* Marks the input row as 'processed'. (This change will rollback if there is
* problem later)
- *
+ *
* @param item type
- *
+ *
* @see StagingItemReader
* @see StagingItemWriter
* @see ProcessIndicatorItemWrapper
- *
+ *
* @author Robert Kasanicky
*/
public class StagingItemProcessor implements ItemProcessor, T>, InitializingBean {
- private SimpleJdbcOperations jdbcTemplate;
+ private JdbcOperations jdbcTemplate;
- public void setJdbcTemplate(SimpleJdbcOperations jdbcTemplate) {
+ public void setJdbcTemplate(JdbcOperations jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
public void setDataSource(DataSource dataSource) {
- this.jdbcTemplate = new SimpleJdbcTemplate(dataSource);
+ this.jdbcTemplate = new JdbcTemplate(dataSource);
}
public void afterPropertiesSet() throws Exception {
diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemReader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemReader.java
index f40b7c1be..757033fbc 100644
--- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemReader.java
+++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/common/StagingItemReader.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2007 the original author or authors.
+ * Copyright 2006-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,14 +34,15 @@ import org.springframework.batch.support.SerializationUtils;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.dao.DataAccessException;
+import org.springframework.jdbc.core.JdbcOperations;
+import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
-import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.util.Assert;
/**
* Thread-safe database {@link ItemReader} implementing the process indicator
* pattern.
- *
+ *
* To achieve restartability use together with {@link StagingItemProcessor}.
*/
public class StagingItemReader implements ItemReader>, StepExecutionListener,
@@ -57,10 +58,10 @@ public class StagingItemReader implements ItemReader keys;
- private SimpleJdbcTemplate jdbcTemplate;
+ private JdbcOperations jdbcTemplate;
public void setDataSource(DataSource dataSource) {
- jdbcTemplate = new SimpleJdbcTemplate(dataSource);
+ jdbcTemplate = new JdbcTemplate(dataSource);
}
public void destroy() throws Exception {
diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDao.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDao.java
index bcf67aca4..6074bde1f 100644
--- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDao.java
+++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDao.java
@@ -22,10 +22,10 @@ import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.sample.domain.football.Game;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
-import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;
+import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
-public class JdbcGameDao extends SimpleJdbcDaoSupport implements ItemWriter {
+public class JdbcGameDao extends JdbcDaoSupport implements ItemWriter {
private SimpleJdbcInsert insertGame;
diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerDao.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerDao.java
index fea347d8a..b406ed006 100644
--- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerDao.java
+++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerDao.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2007 the original author or authors.
+ * Copyright 2006-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,25 +16,31 @@
package org.springframework.batch.sample.domain.football.internal;
+import javax.sql.DataSource;
+
import org.springframework.batch.sample.domain.football.Player;
import org.springframework.batch.sample.domain.football.PlayerDao;
-import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;
import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
/**
* @author Lucas Ward
*
*/
-public class JdbcPlayerDao extends SimpleJdbcDaoSupport implements PlayerDao {
+public class JdbcPlayerDao implements PlayerDao {
public static final String INSERT_PLAYER =
"INSERT into PLAYERS (player_id, last_name, first_name, pos, year_of_birth, year_drafted)" +
" values (:id, :lastName, :firstName, :position, :birthYear, :debutYear)";
-
- public void savePlayer(Player player) {
-
- getSimpleJdbcTemplate().update(INSERT_PLAYER,
- new BeanPropertySqlParameterSource(player));
-
+
+ private NamedParameterJdbcOperations namedParameterJdbcTemplate;
+
+ public void savePlayer(Player player) {
+ namedParameterJdbcTemplate.update(INSERT_PLAYER, new BeanPropertySqlParameterSource(player));
}
+
+ public void setDataSource(DataSource dataSource) {
+ this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
+ }
}
diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerSummaryDao.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerSummaryDao.java
index 1db556c4a..f3ca7b1ad 100644
--- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerSummaryDao.java
+++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcPlayerSummaryDao.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2007 the original author or authors.
+ * Copyright 2006-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,18 +18,23 @@ package org.springframework.batch.sample.domain.football.internal;
import java.util.List;
+import javax.sql.DataSource;
+
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.sample.domain.football.PlayerSummary;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
-import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
-public class JdbcPlayerSummaryDao extends SimpleJdbcDaoSupport implements ItemWriter {
+public class JdbcPlayerSummaryDao implements ItemWriter {
private static final String INSERT_SUMMARY = "INSERT into PLAYER_SUMMARY(ID, YEAR_NO, COMPLETES, ATTEMPTS, PASSING_YARDS, PASSING_TD, "
+ "INTERCEPTIONS, RUSHES, RUSH_YARDS, RECEPTIONS, RECEPTIONS_YARDS, TOTAL_TD) "
+ "values(:id, :year, :completes, :attempts, :passingYards, :passingTd, "
+ ":interceptions, :rushes, :rushYards, :receptions, :receptionYards, :totalTd)";
+ private NamedParameterJdbcOperations namedParameterJdbcTemplate;
+
public void write(List extends PlayerSummary> summaries) {
for (PlayerSummary summary : summaries) {
@@ -42,10 +47,11 @@ public class JdbcPlayerSummaryDao extends SimpleJdbcDaoSupport implements ItemWr
summary.getReceptions()).addValue("receptionYards", summary.getReceptionYards()).addValue(
"totalTd", summary.getTotalTd());
- getSimpleJdbcTemplate().update(INSERT_SUMMARY, args);
-
+ namedParameterJdbcTemplate.update(INSERT_SUMMARY, args);
}
-
}
+ public void setDataSource(DataSource dataSource) {
+ this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
+ }
}
diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcCustomerDebitDao.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcCustomerDebitDao.java
index c3a956b41..efda0ab1b 100644
--- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcCustomerDebitDao.java
+++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcCustomerDebitDao.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2007 the original author or authors.
+ * Copyright 2006-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,28 +21,28 @@ import javax.sql.DataSource;
import org.springframework.batch.sample.domain.trade.CustomerDebit;
import org.springframework.batch.sample.domain.trade.CustomerDebitDao;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.core.simple.SimpleJdbcOperations;
-import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
+import org.springframework.jdbc.core.JdbcOperations;
+import org.springframework.jdbc.core.JdbcTemplate;
/**
* Reduces customer's credit by the provided amount.
- *
+ *
* @author Robert Kasanicky
*/
public class JdbcCustomerDebitDao implements CustomerDebitDao {
-
+
private static final String UPDATE_CREDIT = "UPDATE CUSTOMER SET credit= credit-? WHERE name=?";
-
- private SimpleJdbcOperations simpleJdbcTemplate;
+
+ private JdbcOperations jdbcTemplate;
public void write(CustomerDebit customerDebit) {
- simpleJdbcTemplate.update(UPDATE_CREDIT, customerDebit.getDebit(), customerDebit.getName());
+ jdbcTemplate.update(UPDATE_CREDIT, customerDebit.getDebit(), customerDebit.getName());
}
@Autowired
public void setDataSource(DataSource dataSource) {
- this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
+ this.jdbcTemplate = new JdbcTemplate(dataSource);
}
}
diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcTradeDao.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcTradeDao.java
index 7ba7d373a..3b68f97b5 100644
--- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcTradeDao.java
+++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/JdbcTradeDao.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2007 the original author or authors.
+ * Copyright 2006-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.sample.domain.trade.Trade;
import org.springframework.batch.sample.domain.trade.TradeDao;
-import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
+import org.springframework.jdbc.core.JdbcOperations;
+import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
@@ -41,7 +42,7 @@ public class JdbcTradeDao implements TradeDao {
/**
* handles the processing of sql query
*/
- private SimpleJdbcTemplate simpleJdbcTemplate;
+ private JdbcOperations jdbcTemplate;
/**
* database is not expected to be setup for autoincrement
@@ -54,13 +55,13 @@ public class JdbcTradeDao implements TradeDao {
public void writeTrade(Trade trade) {
Long id = incrementer.nextLongValue();
log.debug("Processing: " + trade);
- simpleJdbcTemplate.update(INSERT_TRADE_RECORD,
+ jdbcTemplate.update(INSERT_TRADE_RECORD,
id, trade.getIsin(), trade.getQuantity(), trade.getPrice(),
trade.getCustomer());
}
public void setDataSource(DataSource dataSource) {
- this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
+ this.jdbcTemplate = new JdbcTemplate(dataSource);
}
public void setIncrementer(DataFieldMaxValueIncrementer incrementer) {
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/CompositeItemWriterSampleFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/CompositeItemWriterSampleFunctionalTests.java
index 4b038499f..37f42a5c7 100644
--- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/CompositeItemWriterSampleFunctionalTests.java
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/CompositeItemWriterSampleFunctionalTests.java
@@ -18,8 +18,9 @@ import org.junit.runner.RunWith;
import org.springframework.batch.sample.domain.trade.Trade;
import org.springframework.batch.test.JobLauncherTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcOperations;
+import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowCallbackHandler;
-import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -35,21 +36,21 @@ public class CompositeItemWriterSampleFunctionalTests {
+ "Trade: [isin=UK21341EAH44,quantity=214,price=34.11,customer=customer4]"
+ "Trade: [isin=UK21341EAH45,quantity=215,price=35.11,customer=customer5]";
- private SimpleJdbcTemplate simpleJdbcTemplate;
+ private JdbcOperations jdbcTemplate;
@Autowired
private JobLauncherTestUtils jobLauncherTestUtils;
@Autowired
public void setDataSource(DataSource dataSource) {
- this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
+ this.jdbcTemplate = new JdbcTemplate(dataSource);
}
@Test
public void testJobLaunch() throws Exception {
- simpleJdbcTemplate.update("DELETE from TRADE");
- int before = simpleJdbcTemplate.queryForInt("SELECT COUNT(*) from TRADE");
+ jdbcTemplate.update("DELETE from TRADE");
+ int before = jdbcTemplate.queryForInt("SELECT COUNT(*) from TRADE");
jobLauncherTestUtils.launchJob();
@@ -70,12 +71,12 @@ public class CompositeItemWriterSampleFunctionalTests {
}
};
- int after = simpleJdbcTemplate.queryForInt("SELECT COUNT(*) from TRADE");
+ int after = jdbcTemplate.queryForInt("SELECT COUNT(*) from TRADE");
assertEquals(before + 5, after);
-
- simpleJdbcTemplate.getJdbcOperations().query(GET_TRADES, new RowCallbackHandler() {
+
+ jdbcTemplate.query(GET_TRADES, new RowCallbackHandler() {
private int activeRow = 0;
public void processRow(ResultSet rs) throws SQLException {
Trade trade = trades.get(activeRow++);
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/CustomerFilterJobFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/CustomerFilterJobFunctionalTests.java
index 8eb2910e5..afea2890f 100644
--- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/CustomerFilterJobFunctionalTests.java
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/CustomerFilterJobFunctionalTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2007 the original author or authors.
+ * Copyright 2006-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,8 +34,9 @@ import org.junit.runner.RunWith;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.test.JobLauncherTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcOperations;
+import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowCallbackHandler;
-import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -48,7 +49,7 @@ public class CustomerFilterJobFunctionalTests {
private List customers;
private int activeRow = 0;
- private SimpleJdbcTemplate simpleJdbcTemplate;
+ private JdbcOperations jdbcTemplate;
private Map credits = new HashMap();
@Autowired
@@ -56,15 +57,15 @@ public class CustomerFilterJobFunctionalTests {
@Autowired
public void setDataSource(DataSource dataSource) {
- this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
+ this.jdbcTemplate = new JdbcTemplate(dataSource);
}
@Before
public void onSetUp() throws Exception {
- simpleJdbcTemplate.update("delete from TRADE");
- simpleJdbcTemplate.update("delete from CUSTOMER where ID > 4");
- simpleJdbcTemplate.update("update CUSTOMER set credit=100000");
- List