如何将返回的计数值存储到变量中,然后可以使用它设置属性?到目前为止,这是我的方法:
public List<Sighting> total() {
return jdbc.query("select pest_name, count(pest_name) from sighting group by pest_name", new RowMapper<Sighting>() {
public Sighting mapRow(ResultSet rs, int rowNum) throws SQLException {
Sighting sighting = new Sighting();
sighting.setCount(????); // I need to pass a variable to setCount()
sighting.setPest_name(rs.getString("pest_name"));
return sighting;
}
});
}
查询中的计数值..