Hans Desmet opened SPR-16242 and commented

The JdbcTemplate class has a method queryForObject(java.lang.String sql, java.lang.Class\ requiredType), which is handy when the SQL statement has no parameters. Example:

jdbcTemplate.queryForObject("select count(*) from clients", Long.class);

The NamedParameterJdbcTemplate does not have such a method, so you must use another version of the method, which leads to a longer less readable example:

namedParameterJdbcTemplate.queryForObject("select count(*) from clients", Collections.emptyMap(),Long.class);

No further details from SPR-16242

Comment From: snicoll

None of the methods in NameParameterJdbcTemplate have a shortcut when no arguments are provided. Given that the very purpose of the template is to manage (named) arguments, this seems the right call, using the code above if you happen to use the template with a query that doesn't have arguments.

In the meantime, JdbcClient can also offer a nice trade-off for this.