The queryforInt/queryforLong methods in JdbcTemplate are deprecated in Spring 3.2. I can\'t find out why or what is considered the best practice to replace existing code using t
JdbcTemplate#queryForInt
returns 0 if the column value is SQL NULL or 0. There is no way to distinguish one case from the other. I think this is the main reason why the method is deprecated. BTW, ResultSet#getInt
behaves similarly. Though, we can distinguish between these two cases by ResultSet#wasNull
.