在spring 3.2.2之后,jdbcTemplate.queryForInt已经被取消了!
原来是这样写的:String sql = "SELECT count(*) FROM USERS WHERE username = ?"; boolean result = false; int count = getJdbcTemplate().queryForInt(sql, new Object[] { username }); if (count > 0) { result = true; }
int count = getJdbcTemplate().queryForObject( sql, new Object[] { username }, Integer.class);
protected Object selectByJdbcTemplateObject(String sql, Object[] parameters) { if (parameters != null && parameters.length > 0) { return jdbcTemplate.queryForObject(sql, parameters, java.lang.Long.class); } else { return jdbcTemplate.queryForObject(sql, java.lang.Long.class); } }