如何在jdbcTemplate.update中标识导致问题的垃圾数据中的失败记录?

问题描述

我正在使用Spring JdbcTemplateNamedParameterJdbcTemplate批量更新记录。我们如何在这里要更新的500条记录中找出10条是垃圾记录?

我尝试了各种选择,但确实可以为您提供所有500条记录,

List<Map<String,Object>> batchValues = new ArrayList<>(items.size());
for (Employee emp : items) {
    batchValues.add(new MapsqlParameterSource()
            .addValue("",emp.get....)
            .addValue("",emp.get....)
            .getValues());
}

try {       
    int[] updateCounts = namedJdbcTemplate.batchUpdate(sql,batchValues.toArray(new Map[items.size()]));
} catch (Exception e) {
    // How to identify garbage data due to which batchupdate Failed
}

在这里我也看不到任何方法Bulk insert spring jdbc template identify the failed records

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)