<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 保存 ~~~ jt.update("insert into account (name,money) values (?,?)","Milan",200); ~~~ ## 更新 ~~~ jt.update("update account set name = ? where id = ?","jack",1); ~~~ ## 刪除 ~~~ jt.update("delete from account where id = ?",1); ~~~ ## 查詢所有 寫一個累實現RowMapper接口,并實現方法. ~~~ class AccountRowMapper implements RowMapper<Account> { public Account mapRow(ResultSet resultSet, int i) throws SQLException { Account account = new Account(); account.setId(resultSet.getInt("id")); account.setName(resultSet.getString("name")); account.setMoney(resultSet.getFloat("money")); return account; } } ~~~ 查詢: ~~~ //獲取容器 ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); //獲取數據源 JdbcTemplate jt = (JdbcTemplate) context.getBean("jdbcTemplate"); //執行SQL List<Account> list = jt.query("select * from account where money > ?", new AccountRowMapper(), 1000f); System.out.println(list); ~~~ 每次自己寫實現接口太麻煩了,spring給我也提供了和queryRunner一樣的結果集處理的封裝. ~~~ //獲取容器 ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); //獲取數據源 JdbcTemplate jt = (JdbcTemplate) context.getBean("jdbcTemplate"); //執行SQL List<Account> list = jt.query("select * from account where money > ?", new BeanPropertyRowMapper<Account>(Account.class), 1000f); System.out.println(list); ~~~ ## 查詢一個 ~~~ List<Account> list = jt.query("select * from account where id = ?", new BeanPropertyRowMapper<Account>(Account.class), 3); ~~~ ## 查詢返回一行一列 ~~~ Integer count = jt.queryForObject("select count(*) from account", Integer.class); ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看