If you use ? to fill in the parameters NEVER escape that is handled by the JDBC driver...
As I suggest use springs JdbcTemplate and it's batch support.
Code:
public void JdbcBatchUpdate(final List<Actor> actors) {
String sql = "update actor set first_name= ? where actor_id=?";
JdbcTemplate template = new JdbcTemplate(dataSource);
template.batchUpdate(sql, new BatchPreparedStatementSetter() {
public int getBatchSize() {
return actors.size();
}
public void setValues(PreparedStatement ps, int i) throws SQLException {
Actor actor = actors.get(i);
ps.setString(1, actor.getFirstName());
ps.setInt(2, actor.getId());
}
}
}
Of course it would be better to use JdbcDaoSupport and get the JdbcTemplate from there or inject the JdbcTemplate. Constructing a JdbcTemplate is a lengthy business and as it is threadsafe should only occur once.