public Product mapRow(ResultSet rs, int rowNum) throws SQLException { Product product = new Product(); product.setId(rs.getInt("id")); product.setDescription(rs.getString("description")); product.setPrice(new Double(rs.getDouble("price"))); return product; }
@Override public void saveProduct(Product prod) { logger.info("Saving product: " + prod.getDescription()); JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); int count = jdbcTemplate.update( "UPDATE Products SET description = ?, price = ? where id = ?", prod.getDescription(), prod.getPrice(), prod.getId()); logger.info("Rows affected: " + count); }