码上敲享录 > Spring框架常见问题详解分享 > jdbcTemplate如何返回List

jdbcTemplate如何返回List

上一章章节目录下一章 2019-06-14已有6859人阅读 评论(0)

jdbcTemplate如何返回List<String>


解决方法:

List<String> data = jdbcTemplate.query("select name from tb_user", new RowMapper<String>(){

    public String mapRow(ResultSet rs, int rowNum) throws SQLException {

                   return rs.getString(1);

           }

      },null);


向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
12

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交