public List<Long> getxxxx(String no) {
String sql="select id from student where no=? ";
RowMapper rowMapper = new RowMapper() {
public Object mapRow(ResultSet rs, int index) throws SQLException {
StuBean stuBean=new StuBean();
stuBean.setId(rs.getLong("id"));
return stuBean.getId();
}
};
return getJdbcTemplate().query(sql,new Object[]{no},rowMapper);
}
class StuBean{
private Long id; setter//
getter//
}写法有错误吗?在数据库里写sql可以查到100+记录,但用程序一条也没出来,也不报错,为什么?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货