spring jdbc template查詢的結(jié)果集不用手動遍歷?
為什么這里的ResultSet不用While循環(huán)?我還用循環(huán)去遍歷,結(jié)果少了第一條數(shù)據(jù)
jdbcTemplate.query(sql,?new?RowCallbackHandler()?{ ????@Override ????public?void?processRow(ResultSet?resultSet)?throws?SQLException?{ ????????????????int?id=resultSet.getInt("id"); ????????????????String?name=resultSet.getString("name"); ????????????????int?age=resultSet.getInt("age"); ????????????????Student?student=new?Student(id,name,age); ????????????????list.add(student); ????} });
2018-07-31
ResultSet? ?這個是對象啊,不是數(shù)組和集合,你為什么要便利他
2017-04-22
模板內(nèi)部封裝好了