diff --git a/src/reference/docbook/jdbc.xml b/src/reference/docbook/jdbc.xml index 39ff7f3b75..7db4b16caf 100644 --- a/src/reference/docbook/jdbc.xml +++ b/src/reference/docbook/jdbc.xml @@ -304,12 +304,12 @@ Here is a simple query for getting the number of rows in a relation: - int rowCount = this.jdbcTemplate.queryForObject("select count(*) from t_actor", int.class); + int rowCount = this.jdbcTemplate.queryForObject("select count(*) from t_actor", Integer.class); A simple query using a bind variable: int countOfActorsNamedJoe = this.jdbcTemplate.queryForObject( - "select count(*) from t_actor where first_name = ?", int.class, "Joe"); + "select count(*) from t_actor where first_name = ?", Integer.class, "Joe"); Querying for a String: @@ -567,7 +567,7 @@ public int countOfActorsByFirstName(String firstName) { SqlParameterSource namedParameters = new MapSqlParameterSource("first_name", firstName); - return this.namedParameterJdbcTemplate.queryForObject(sql, int.class, namedParameters); + return this.namedParameterJdbcTemplate.queryForObject(sql, Integer.class, namedParameters); } Notice the use of the named parameter notation in the value @@ -600,7 +600,7 @@ public int countOfActorsByFirstName(String firstName) { Map<String, String> namedParameters = Collections.singletonMap("first_name", firstName); - return this.namedParameterJdbcTemplate.queryForObject(sql, int.class, namedParameters); + return this.namedParameterJdbcTemplate.queryForObject(sql, Integer.class, namedParameters); } One nice feature related to the @@ -664,7 +664,7 @@ public int countOfActors(Actor exampleActor) { SqlParameterSource namedParameters = new BeanPropertySqlParameterSource(exampleActor); - return this.namedParameterJdbcTemplate.queryForObject(sql, int.class, namedParameters); + return this.namedParameterJdbcTemplate.queryForObject(sql, Integer.class, namedParameters); } Remember that the @@ -860,7 +860,7 @@ public class RunAQuery { } public int getCount() { - return this.jdbcTemplate.queryForObject("select count(*) from mytable", int.class); + return this.jdbcTemplate.queryForObject("select count(*) from mytable", Integer.class); } public String getName() {