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使用方法
时间: 2024-10-30 04:16:21