spring-guides / gs-relational-data-access

Accessing Relational Data using JDBC with Spring :: Learn how to access relational data with Spring.

Home Page:https://spring.io/guides/gs/relational-data-access/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

gilles-phan opened this issue · comments

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

I see.

@gilles-phan Thanks for solving my issue #28 this way!

Closing as a duplicate of #28

See also #34