SimpleJdbcInsert equivalent for update

jdbc, simplejdbcinsert, spring, sql-update

Solution

You have to use JdbcTemplate

See: 13.2.1.1 Examples of JdbcTemplate class usage

E.X:

this.jdbcTemplate.update(
    "update t_actor set = ? where id = ?", 
    "Banjo", 5276L);

Problem

I am using Spring's SimpleJdbcInsert class to create entities - eg: ``` final SimpleJdbcInsert insert = new SimpleJdbcInsert(dataSource).withTableName("abc"); insert.execute(new BeanPropertySqlParameterSource(abc)); ``` Is there some equivalent of this class for doing updates? As an example, something like the below would be a convenient interface, assuming we are dealing with a single column primary key: ``` final SimpleJdbcUpdate update = new SimpleJdbcUpdate(dataSource).withTableName("abc").withIdColumn("abcId"); update.execute(new BeanPropertySqlParameterSource(abc)); ``` Does Spring provide this functionality out-of-the-box somewhere? Thanks Jay

Original source