Spring JDBC を使用すると、私はいつも次のようなことをしていることに気づきます。
NamedParameterJdbcTemplat njt = ...;
String SQL = "SELECT blah FROM blah_table WHERE column = :condition";
SqlParameterSource params = new MapSqlParameterSource('condition', variableName);
List<Integer> rows = njt.query(SQL, params, Integer.class);
if(rows.size() == 0)
{
//record did not exist, whew avoided index out of bounds exception
}
//do something with rows.get(0);
もっと良い方法があるはずですよね?