simpleJdbcTemplate使用方法

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使用方法)