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:
@@ -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()];
|
||||
|
||||
Reference in New Issue
Block a user