日期:2014-05-18  浏览次数:20646 次

SPRINGMVC 无法取得查询结果
使用的是
jdbcTemplate.query(sql,rm);
获取数据
rm为一个实现了RowMapper接口的类。

public PhoneCountVO mapRow(ResultSet rs, int num) throws SQLException
{
PhoneCountVO entity=new PhoneCountVO();
entity.setCount(rs.getInt("count"));
entity.setTitle(rs.getString("title"));
entity.setCityId(rs.getInt("city_id"));
return entity;
}

传递进入的SQL在数据库内直接查询无问题,但是调用方法后无法返回数据。

------解决方案--------------------
List<PhoneCountVO> list = jdbcTemplate.query(sql,rm);