我已经看到了使用 ArrayList 进行批量更新的代码,如下所示:
@Override
public void saveBatch(final List<Employee> employeeList) {
final int batchSize = 500;
for (int j = 0; j < employeeList.size(); j += batchSize) {
final List<Employee> batchList = employeeList.subList(j, j + batchSize > employeeList.size() ? employeeList.size() : j + batchSize);
getJdbcTemplate().batchUpdate(QUERY_SAVE,
new BatchPreparedStatementSetter() {
@Override
public void setValues(PreparedStatement ps, int i)
throws SQLException {
Employee employee = batchList.get(i);
ps.setString(1, employee.getFirstname());
ps.setString(2, employee.getLastname());
ps.setString(3, employee.getEmployeeIdOnSourceSystem());
}
@Override
public int getBatchSize() {
return batchList.size();
}
});
}
}
但是如果我像下面这样使用Hashmap:HashMap<String, VerifyPaymentRO> verifyPaymentInfoMap
VerifyPaymentRO
是java bean
我如何使用它来更新记录?