There is also UpdatableSqlQuery that operates on an updatable ResultSet. It lets you map/update row values in an updateRow callback method. It is similar to the MappingSqlQuery class except that it lets you update the rows as they pass through.
Code:
private class MyUpdate extends UpdatableSqlQuery {
private final static String sql = "select id, price from booking where id > ?";
public MyUpdate(DataSource ds) {
super(ds, sql);
declareParameter(new SqlParameter("id", Types.INTEGER));
compile();
}
protected Object updateRow(ResultSet rs, int rowNum, Map context) throws SQLException {
BigDecimal price = rs.getBigDecimal(2);
price = price.multiply(new BigDecimal(1.1));
rs.updateBigDecimal(2, price);
return price;
}
}