List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>();
String sql = "select id, name from ..................";//略
rows = getSimpleJdbcTemplate().queryForList(sqlBuffer.toString());
for (Map<String, Object> row : rows) {
int id = NumberUtils.toInt(row.get("id").toString());
String name = row.get("name");
User u = new User(id, name);//for example
}
simpleJdbcTemplate使用方法,布布扣,bubuko.com
原文地址:http://my.oschina.net/u/1773689/blog/293178