/** * 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; }
/** * 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; }
/** * 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 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; }
/** * 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; }