spring-guides / getting-started-guides

Getting Started Guide template :: The template for new guides and also the place to request them.
https://github.com/spring-guides/getting-started-guides/wiki
Apache License 2.0
518 stars 204 forks source link

Function deprecated for "Accessing Relational Data using JDBC with Spring" #142

Closed gilles-phan closed 2 years ago

gilles-phan commented 2 years ago

Hi,

Description: For the page "Accessing Relational Data using JDBC with Spring", the method RelationalDataAccessApplication#run call to a deprecated function: jdbcTemplate.query(....

Details: Deprecated function "query" in JdbcTemplate:

@Deprecated
@Override
public <T> List<T> query(String sql, @Nullable Object[] args, RowMapper<T> rowMapper) throws DataAccessException {
    return result(query(sql, args, new RowMapperResultSetExtractor<>(rowMapper)));
}

The function to call

@Override
public <T> List<T> query(String sql, RowMapper<T> rowMapper, @Nullable Object... args) throws DataAccessException {
    return result(query(sql, args, new RowMapperResultSetExtractor<>(rowMapper)));
}

Fix: To fix it, we should simply invert the two last param (args and rowmapper).

Regards, Gilles

gilles-phan commented 2 years ago

Issue moved to correct guide.