Polish BatchPreparedStatementSetter example in reference manual

Closes gh-24084
This commit is contained in:
Sam Brannen
2019-11-29 18:50:42 +01:00
parent 5648ef3276
commit 52a1fc4329

View File

@@ -3848,9 +3848,10 @@ based on entries in a list, and the entire list is used as the batch:
"update t_actor set first_name = ?, last_name = ? where id = ?",
new BatchPreparedStatementSetter() {
public void setValues(PreparedStatement ps, int i) throws SQLException {
ps.setString(1, actors.get(i).getFirstName());
ps.setString(2, actors.get(i).getLastName());
ps.setLong(3, actors.get(i).getId().longValue());
Actor actor = actors.get(i);
ps.setString(1, actor.getFirstName());
ps.setString(2, actor.getLastName());
ps.setLong(3, actor.getId().longValue());
}
public int getBatchSize() {
return actors.size();