Jdbc writer fixed to allow Map, named params, and ItemSqlParameterSourceProvider

In merging BATCH-1955, we accidentally prevented the ability to use a
Map as an item, named parameters, and an ItemSqlParameterSourceProvider.
This commit re-enables that capability by checking if the
ItemSqlParameterSourceProvider is null.  If it's not, it's used.
This commit is contained in:
Michael Minella
2017-01-26 11:37:56 -06:00
parent 54a90beed7
commit 4917ac3017
2 changed files with 30 additions and 1 deletions

View File

@@ -171,7 +171,7 @@ public class JdbcBatchItemWriter<T> implements ItemWriter<T>, InitializingBean {
int[] updateCounts;
if (usingNamedParameters) {
if(items.get(0) instanceof Map) {
if(items.get(0) instanceof Map && this.itemSqlParameterSourceProvider == null) {
updateCounts = namedParameterJdbcTemplate.batchUpdate(sql, items.toArray(new Map[items.size()]));
} else {
SqlParameterSource[] batchArgs = new SqlParameterSource[items.size()];