Package org.springframework.jdbc.core.simple

Examples of org.springframework.jdbc.core.simple.SimpleJdbcTemplate


public class AdapterConferenceTestDao extends AbstractTransactionalJUnit4SpringContextTests {

  @Override
  @Autowired
  public void setDataSource(@Qualifier(value = "conferenceDataSource") DataSource dataSource) {
     this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
  }
View Full Code Here


    }
  }

  @Resource
  public void setDataSource(DataSource dataSource) {
    jdbcTemplate = new SimpleJdbcTemplate(dataSource);
  }
View Full Code Here

  /**
   * 根据注入的DataSource创建jdbcTemplate.
   */
  @Resource
  public void setDataSource(DataSource dataSource) {
    jdbcTemplate = new SimpleJdbcTemplate(dataSource);
  }
View Full Code Here

    private SimpleJdbcTemplate simpleJdbcTemplate;
    private SimpleJdbcInsert simpleInsert;

    @Autowired
  public void init(DataSource dataSource) {
    this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
        this.simpleInsert = new SimpleJdbcInsert(dataSource);
        this.simpleInsert.withTableName("contacts").usingGeneratedKeyColumns("id");
  }
View Full Code Here

  private SimpleJdbcTemplate jdbcTemplate;

  @Autowired
  public void setDataSource(DataSource dataSource) {
    jdbcTemplate = new SimpleJdbcTemplate(dataSource);
  }
View Full Code Here

  private SimpleJdbcTemplate jdbcTemplate;

  @Autowired
  public void setDataSource(DataSource dataSource) {
    jdbcTemplate = new SimpleJdbcTemplate(dataSource);
  }
View Full Code Here

  private SimpleJdbcTemplate jdbcTemplate;
 
  private DataFieldMaxValueIncrementer incrementer;

  public void setDataSource(DataSource dataSource) {
    jdbcTemplate = new SimpleJdbcTemplate(dataSource);
  }
View Full Code Here

//    return now;
    return new Timestamp(System.currentTimeMillis()+ (timeoutSeconds * 1000));
  }

  private SimpleJdbcTemplate getSimpleJdbcTemplate() {
    return new SimpleJdbcTemplate(dataSource);
  }
View Full Code Here

    public void setDataSource(DataSource ds) {

        // Initializes the in-memory database (not necessary in production)
        if (!initialized) {
            SimpleJdbcTemplate jt = new SimpleJdbcTemplate(ds);
            jt.update("CREATE TABLE sample_table ( id INTEGER IDENTITY, str_col VARCHAR(256), num_col INTEGER)");
            jt.update("INSERT INTO sample_table(str_col,num_col) VALUES('Ford', 100)");
            jt.update("INSERT INTO sample_table(str_col,num_col) VALUES('Toyota', 200)");
            jt.update("INSERT INTO sample_table(str_col,num_col) VALUES('Mazda', 300)");
            initialized = true;
        }
        this.ds = ds;
    }
View Full Code Here

    public String execute() {

        // Only refresh the data every minute as needed
        long now = System.currentTimeMillis();
        if (lastLoaded + CACHE_TIME < now) {
            SimpleJdbcTemplate jt = new SimpleJdbcTemplate(ds);
            data = jt.queryForList("SELECT * FROM sample_table");
            lastLoaded = now;
        }
        return SUCCESS;
    }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.simple.SimpleJdbcTemplate

Copyright © 2018 www.massapicom. 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.