/** * Generic method to execute the update given parameters. * All other update methods invoke this method. * @param params array of parameters objects * @return the number of rows affected by the update */ public int update(Object... params) throws DataAccessException { validateParameters(params); int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(params)); checkRowsAffected(rowsAffected); return rowsAffected; }
/** * Method to execute the update given arguments and * retrieve the generated keys using a KeyHolder. * @param params array of parameter objects * @param generatedKeyHolder the KeyHolder that will hold the generated keys * @return the number of rows affected by the update */ public int update(Object[] params, KeyHolder generatedKeyHolder) throws DataAccessException { if (!isReturnGeneratedKeys() && getGeneratedKeysColumnNames() == null) { throw new InvalidDataAccessApiUsageException( "The update method taking a KeyHolder should only be used when generated keys have " + "been configured by calling either 'setReturnGeneratedKeys' or " + "'setGeneratedKeysColumnNames'."); } validateParameters(params); int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(params), generatedKeyHolder); checkRowsAffected(rowsAffected); return rowsAffected; }
/** * Generic method to execute the update given named parameters. * All other update methods invoke this method. * @param paramMap a Map of parameter name to parameter object, * matching named parameters specified in the SQL statement * @return the number of rows affected by the update */ public int updateByNamedParam(Map<String, ?> paramMap) throws DataAccessException { validateNamedParameters(paramMap); ParsedSql parsedSql = getParsedSql(); MapSqlParameterSource paramSource = new MapSqlParameterSource(paramMap); String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource); Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, getDeclaredParameters()); int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(sqlToUse, params)); checkRowsAffected(rowsAffected); return rowsAffected; }
/** * Method to execute the update given arguments and * retrieve the generated keys using a KeyHolder. * @param paramMap a Map of parameter name to parameter object, * matching named parameters specified in the SQL statement * @param generatedKeyHolder the KeyHolder that will hold the generated keys * @return the number of rows affected by the update */ public int updateByNamedParam(Map<String, ?> paramMap, KeyHolder generatedKeyHolder) throws DataAccessException { validateNamedParameters(paramMap); ParsedSql parsedSql = getParsedSql(); MapSqlParameterSource paramSource = new MapSqlParameterSource(paramMap); String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource); Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, getDeclaredParameters()); int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(sqlToUse, params), generatedKeyHolder); checkRowsAffected(rowsAffected); return rowsAffected; }
/** * Generic method to execute the update given parameters. * All other update methods invoke this method. * @param params array of parameters objects * @return the number of rows affected by the update */ public int update(Object... params) throws DataAccessException { validateParameters(params); int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(params)); checkRowsAffected(rowsAffected); return rowsAffected; }
/** * Generic method to execute the update given parameters. * All other update methods invoke this method. * @param params array of parameters objects * @return the number of rows affected by the update */ public int update(Object... params) throws DataAccessException { validateParameters(params); int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(params)); checkRowsAffected(rowsAffected); return rowsAffected; }
/** * Method to execute the update given arguments and * retrieve the generated keys using a KeyHolder. * @param params array of parameter objects * @param generatedKeyHolder KeyHolder that will hold the generated keys * @return the number of rows affected by the update */ public int update(Object[] params, KeyHolder generatedKeyHolder) throws DataAccessException { if (!isReturnGeneratedKeys() && getGeneratedKeysColumnNames() == null) { throw new InvalidDataAccessApiUsageException( "The update method taking a KeyHolder should only be used when generated keys have " + "been configured by calling either 'setReturnGeneratedKeys' or " + "'setGeneratedKeysColumnNames'."); } validateParameters(params); int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(params), generatedKeyHolder); checkRowsAffected(rowsAffected); return rowsAffected; }
/** * Method to execute the update given arguments and * retrieve the generated keys using a KeyHolder. * @param params array of parameter objects * @param generatedKeyHolder the KeyHolder that will hold the generated keys * @return the number of rows affected by the update */ public int update(Object[] params, KeyHolder generatedKeyHolder) throws DataAccessException { if (!isReturnGeneratedKeys() && getGeneratedKeysColumnNames() == null) { throw new InvalidDataAccessApiUsageException( "The update method taking a KeyHolder should only be used when generated keys have " + "been configured by calling either 'setReturnGeneratedKeys' or " + "'setGeneratedKeysColumnNames'."); } validateParameters(params); int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(params), generatedKeyHolder); checkRowsAffected(rowsAffected); return rowsAffected; }
/** * Generic method to execute the update given named parameters. * All other update methods invoke this method. * @param paramMap Map of parameter name to parameter object, * matching named parameters specified in the SQL statement * @return the number of rows affected by the update */ public int updateByNamedParam(Map<String, ?> paramMap) throws DataAccessException { validateNamedParameters(paramMap); ParsedSql parsedSql = getParsedSql(); MapSqlParameterSource paramSource = new MapSqlParameterSource(paramMap); String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource); Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, getDeclaredParameters()); int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(sqlToUse, params)); checkRowsAffected(rowsAffected); return rowsAffected; }
/** * Method to execute the update given arguments and * retrieve the generated keys using a KeyHolder. * @param paramMap Map of parameter name to parameter object, * matching named parameters specified in the SQL statement * @param generatedKeyHolder KeyHolder that will hold the generated keys * @return the number of rows affected by the update */ public int updateByNamedParam(Map<String, ?> paramMap, KeyHolder generatedKeyHolder) throws DataAccessException { validateNamedParameters(paramMap); ParsedSql parsedSql = getParsedSql(); MapSqlParameterSource paramSource = new MapSqlParameterSource(paramMap); String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource); Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, getDeclaredParameters()); int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(sqlToUse, params), generatedKeyHolder); checkRowsAffected(rowsAffected); return rowsAffected; }
/** * Generic method to execute the update given named parameters. * All other update methods invoke this method. * @param paramMap a Map of parameter name to parameter object, * matching named parameters specified in the SQL statement * @return the number of rows affected by the update */ public int updateByNamedParam(Map<String, ?> paramMap) throws DataAccessException { validateNamedParameters(paramMap); ParsedSql parsedSql = getParsedSql(); MapSqlParameterSource paramSource = new MapSqlParameterSource(paramMap); String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource); Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, getDeclaredParameters()); int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(sqlToUse, params)); checkRowsAffected(rowsAffected); return rowsAffected; }
/** * Method to execute the update given arguments and * retrieve the generated keys using a KeyHolder. * @param paramMap a Map of parameter name to parameter object, * matching named parameters specified in the SQL statement * @param generatedKeyHolder the KeyHolder that will hold the generated keys * @return the number of rows affected by the update */ public int updateByNamedParam(Map<String, ?> paramMap, KeyHolder generatedKeyHolder) throws DataAccessException { validateNamedParameters(paramMap); ParsedSql parsedSql = getParsedSql(); MapSqlParameterSource paramSource = new MapSqlParameterSource(paramMap); String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource); Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, getDeclaredParameters()); int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(sqlToUse, params), generatedKeyHolder); checkRowsAffected(rowsAffected); return rowsAffected; }