Package org.springframework.jdbc.core.simple

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


   private SimpleJdbcInsert bookInsert;

   @Autowired(required = true)
   public void initialize(final DataSource dataSource) {
      this.jdbcTemplate = new SimpleJdbcTemplate(dataSource);
      this.bookInsert = new SimpleJdbcInsert(dataSource).withTableName("books")
               .usingGeneratedKeyColumns("id");
   }
View Full Code Here


  @Resource
  private DataSource dataSource;

  @Before
  public void setUp() {
    this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
  }
View Full Code Here

        restaurant.persist();
        return restaurant;
    }

    private void dumpResults(String sql) {
        final List<Map<String, Object>> result = new SimpleJdbcTemplate(dataSource).queryForList(sql);
        System.out.println("result = " + result);
    }
View Full Code Here

    _secMaster.setClock(Clock.fixed(now, ZoneOffset.UTC));
    _version1Instant = now.minusSeconds(100);
    _version2Instant = now.minusSeconds(50);
    s_logger.debug("test data now:   {}", _version1Instant);
    s_logger.debug("test data later: {}", _version2Instant);
    final SimpleJdbcTemplate template = _secMaster.getDbConnector().getJdbcTemplate();
    template.update("INSERT INTO sec_security VALUES (?,?,?,?,?, ?,?,?,?)",
        101, 101, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "TestSecurity101", "EQUITY", "D");
    template.update("INSERT INTO sec_security VALUES (?,?,?,?,?, ?,?,?,?)",
        102, 102, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "TestSecurity102", "EQUITY", "D");
    template.update("INSERT INTO sec_security VALUES (?,?,?,?,?, ?,?,?,?)",
        201, 201, toSqlTimestamp(_version1Instant), toSqlTimestamp(_version2Instant), toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "TestSecurity201", "EQUITY", "D");
    template.update("INSERT INTO sec_security VALUES (?,?,?,?,?, ?,?,?,?)",
        202, 201, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, "TestSecurity202", "EQUITY", "D");
    _totalSecurities = 3;
//  id bigint not null,
//  key_scheme varchar(255) not null,
//  key_value varchar(255) not null,
    template.update("INSERT INTO sec_idkey VALUES (?,?,?)",
        1, "A", "B");
    template.update("INSERT INTO sec_idkey VALUES (?,?,?)",
        2, "C", "D");
    template.update("INSERT INTO sec_idkey VALUES (?,?,?)",
        3, "E", "F");
    template.update("INSERT INTO sec_idkey VALUES (?,?,?)",
        4, "GH", "HI");
//  security_id bigint not null,
//  idkey_id bigint not null,
    template.update("INSERT INTO sec_security2idkey VALUES (?,?)",
        101, 1);
    template.update("INSERT INTO sec_security2idkey VALUES (?,?)",
        101, 2);
    template.update("INSERT INTO sec_security2idkey VALUES (?,?)",
        101, 3);
    template.update("INSERT INTO sec_security2idkey VALUES (?,?)",
        102, 1);
    template.update("INSERT INTO sec_security2idkey VALUES (?,?)",
        102, 2);
    template.update("INSERT INTO sec_security2idkey VALUES (?,?)",
        102, 4);
    template.update("INSERT INTO sec_security2idkey VALUES (?,?)",
        201, 2);
    template.update("INSERT INTO sec_security2idkey VALUES (?,?)",
        201, 3);
    template.update("INSERT INTO sec_security2idkey VALUES (?,?)",
        202, 2);
    template.update("INSERT INTO sec_security2idkey VALUES (?,?)",
        202, 3);
  }
View Full Code Here

        restaurant.persist();
        return restaurant;
    }

    private void dumpResults(String sql) {
        final List<Map<String, Object>> result = new SimpleJdbcTemplate(dataSource).queryForList(sql);
        System.out.println("result = " + result);
    }
View Full Code Here

  private final List<Vet> vets = new ArrayList<Vet>();


  @Autowired
  public void init(DataSource dataSource) {
    this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);

    this.insertOwner = new SimpleJdbcInsert(dataSource)
      .withTableName("owners")
      .usingGeneratedKeyColumns("id");
    this.insertPet = new SimpleJdbcInsert(dataSource)
View Full Code Here

   */
  private SimpleJdbcTemplate jdbcTemplate;

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

  private PlatformTransactionManager transactionManager;


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

  @Before
  public void setUp()  {
    dataSource = createTestDataSource();
    repository = new JdbcRewardRepository(dataSource);
    jdbcTemplate = new SimpleJdbcTemplate(dataSource);
  }
View Full Code Here

  protected void setUp() throws Exception {
   
    dataSource = createTestDataSource();
    repository = new JdbcRewardRepository(dataSource);
    repository.setDataSource(dataSource);
    jdbcTemplate = new SimpleJdbcTemplate(dataSource);
  }
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.