Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.JdbcTemplate.queryForList()


  @Test
  public void queryJdbcData() {
    System.out.println("开始查询数据");
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    System.out.println("通过jdbc查询数据条数:"
        + jdbcTemplate.queryForList("select * from user_info").size());
  }
}
View Full Code Here


  private DataSource dbcp;

  @Test
  public void sett() {
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dbcp);
        System.out.println(jdbcTemplate.queryForList("select * from usertab").size());
  }
}
View Full Code Here

  @Test
  public void sett() {
     System.out.println("开始初始化12");
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
        System.out.println(jdbcTemplate.queryForList("select * from user_info").size());
  }
}
View Full Code Here

      @Override
      public void execute(Connection conn) {
        JdbcTemplate jt = JuConnUtils.asJdbcTemplate(conn);
       
        // Reset autoincrement values
        List<Map<String, Object>> res = jt.queryForList("select t.TABLENAME, c.COLUMNNAME " +
            "from sys.SYSCOLUMNS c " +
            "  inner join sys.SYSTABLES t on t.TABLEID = c.REFERENCEID " +
            "where c.AUTOINCREMENTVALUE is not null");
         
        for (Map<String, Object> row : res) {
View Full Code Here

   
    this.connUtil.doWork(new DbWork() {
      @Override
      public void execute(Connection conn) {
        JdbcTemplate jt = JuConnUtils.asJdbcTemplate(conn);
        res.setValue(jt.queryForList(sql, listType));
      }
    });
   
    return res.getValue();
  }
View Full Code Here

      @Override
      public void execute(Connection conn) {
        JdbcTemplate jt = JuConnUtils.asJdbcTemplate(conn);
       
        // Reset autoincrement values
        List<Map<String, Object>> res = jt.queryForList("select c.TABLE_NAME, c.COLUMN_NAME " +
          "from information_schema.columns c " +
          "where c.EXTRA='auto_increment'"); //c.TABLE_NAME='Player'"
               
        for (Map<String, Object> row : res) {
          String tableName = row.get("TABLE_NAME").toString();
View Full Code Here

    DummyJob.param = 0;
    DummyJob.count = 0;

    ClassPathXmlApplicationContext ctx = context("databasePersistence.xml");
    JdbcTemplate jdbcTemplate = new JdbcTemplate(ctx.getBean(DataSource.class));
    assertTrue("No triggers were persisted", jdbcTemplate.queryForList("SELECT * FROM qrtz_triggers").size()>0);
    Thread.sleep(3000);
    try {
      assertTrue(DummyJob.count > 0);
    }
    finally {
View Full Code Here

    Connection connection = DataSourceUtils.getConnection(csds);
    csds.startCloseSuppression(connection);
    tt.execute(new TransactionCallback<Void>() {
      @Override
      public Void doInTransaction(TransactionStatus status) {
        template.queryForList("select baz from bar");
        template.queryForList("select foo from bar");
        return null;
      }
    });
    tt.execute(new TransactionCallback<Void>() {
View Full Code Here

    csds.startCloseSuppression(connection);
    tt.execute(new TransactionCallback<Void>() {
      @Override
      public Void doInTransaction(TransactionStatus status) {
        template.queryForList("select baz from bar");
        template.queryForList("select foo from bar");
        return null;
      }
    });
    tt.execute(new TransactionCallback<Void>() {
      @Override
View Full Code Here

      }
    });
    tt.execute(new TransactionCallback<Void>() {
      @Override
      public Void doInTransaction(TransactionStatus status) {
        template.queryForList("select ham from foo");
        tt2.execute(new TransactionCallback<Void>() {
          @Override
          public Void doInTransaction(TransactionStatus status) {
            template.queryForList("select 1 from eggs");
            return null;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.