Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.JdbcOperations


 

  @Test
  public void testCustomJdbcOperations() throws Exception {
   
    JdbcOperations customJdbcOperations = mock(JdbcOperations.class);
    factory.setJdbcOperations(customJdbcOperations);
    factory.afterPropertiesSet();
    assertEquals(customJdbcOperations, ReflectionTestUtils.getField(factory, "jdbcOperations"));
  }   
View Full Code Here


        PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    DataSource dataSource = this.context.getBean(DataSource.class);
    assertTrue(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource);
    assertNotNull(dataSource);
    JdbcOperations template = new JdbcTemplate(dataSource);
    assertEquals(new Integer(1),
        template.queryForObject("SELECT COUNT(*) from BAR", Integer.class));
  }
View Full Code Here

                    "data.sql"));
    this.context.refresh();
    DataSource dataSource = this.context.getBean(DataSource.class);
    assertTrue(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource);
    assertNotNull(dataSource);
    JdbcOperations template = new JdbcTemplate(dataSource);
    assertEquals(new Integer(1),
        template.queryForObject("SELECT COUNT(*) from FOO", Integer.class));
  }
View Full Code Here

        PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    DataSource dataSource = this.context.getBean(DataSource.class);
    assertTrue(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource);
    assertNotNull(dataSource);
    JdbcOperations template = new JdbcTemplate(dataSource);
    assertEquals(new Integer(1),
        template.queryForObject("SELECT COUNT(*) from FOO", Integer.class));
    assertEquals(new Integer(0),
        template.queryForObject("SELECT COUNT(*) from SPAM", Integer.class));
  }
View Full Code Here

                "encoding-data.sql"));
    this.context.refresh();
    DataSource dataSource = this.context.getBean(DataSource.class);
    assertTrue(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource);
    assertNotNull(dataSource);
    JdbcOperations template = new JdbcTemplate(dataSource);
    assertEquals(new Integer(2),
        template.queryForObject("SELECT COUNT(*) from BAR", Integer.class));
    assertEquals("bar",
        template.queryForObject("SELECT name from BAR WHERE id=1", String.class));
    assertEquals("ばー",
        template.queryForObject("SELECT name from BAR WHERE id=2", String.class));
  }
View Full Code Here

    this.context.publishEvent(new DataSourceInitializedEvent(dataSource));

    assertTrue(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource);
    assertNotNull(dataSource);
    JdbcOperations template = new JdbcTemplate(dataSource);

    try {
      template.queryForObject("SELECT COUNT(*) from BAR", Integer.class);
      fail("Query should have failed as BAR table does not exist");
    }
    catch (BadSqlGrammarException ex) {
      SQLException sqlException = ex.getSQLException();
      int expectedCode = -5501; // user lacks privilege or object not found
View Full Code Here

    s_logger.debug("test data now:   {}", _now);
    s_logger.debug("test data 1: {}", _version1Instant);
    s_logger.debug("test data 2: {}", _version2Instant);
    s_logger.debug("test data 3: {}", _version3Instant);
    s_logger.debug("test data 4: {}", _version4Instant);
    final JdbcOperations template = _htsMaster.getDbConnector().getJdbcOperations();
    template.update("INSERT INTO hts_name VALUES (?,?)",
        1, "N101");
    template.update("INSERT INTO hts_name VALUES (?,?)",
        2, "N102");
    template.update("INSERT INTO hts_name VALUES (?,?)",
        3, "N201");
    template.update("INSERT INTO hts_name VALUES (?,?)",
        4, "N202");
    template.update("INSERT INTO hts_name VALUES (?,?)",
        5, "N203");
    template.update("INSERT INTO hts_data_field VALUES (?,?)",
        11, "DF11");
    template.update("INSERT INTO hts_data_field VALUES (?,?)",
        12, "DF12");
    template.update("INSERT INTO hts_data_source VALUES (?,?)",
        21, "DS21");
    template.update("INSERT INTO hts_data_source VALUES (?,?)",
        22, "DS22");
    template.update("INSERT INTO hts_data_provider VALUES (?,?)",
        31, "DP31");
    template.update("INSERT INTO hts_data_provider VALUES (?,?)",
        32, "DP32");
    template.update("INSERT INTO hts_observation_time VALUES (?,?)",
        41, "OT41");
    template.update("INSERT INTO hts_observation_time VALUES (?,?)",
        42, "OT42");
   
    template.update("INSERT INTO hts_document VALUES (?,?,?,?,?, ?,?,?,?,?, ?)",
        101, 101, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, 1, 11, 21, 31, 41);
    template.update("INSERT INTO hts_document VALUES (?,?,?,?,?, ?,?,?,?,?, ?)",
        102, 102, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, 2, 12, 22, 32, 42);
    template.update("INSERT INTO hts_document VALUES (?,?,?,?,?, ?,?,?,?,?, ?)",
        201, 201, toSqlTimestamp(_version1Instant), toSqlTimestamp(_version2Instant), toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, 3, 11, 21, 31, 41);
    template.update("INSERT INTO hts_document VALUES (?,?,?,?,?, ?,?,?,?,?, ?)",
        202, 201, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version2Instant), toSqlTimestamp(_version3Instant), 4, 11, 21, 31, 42);
    template.update("INSERT INTO hts_document VALUES (?,?,?,?,?, ?,?,?,?,?, ?)",
        203, 201, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version3Instant), MAX_SQL_TIMESTAMP, 5, 11, 21, 31, 42);
    _totalHistoricalTimeSeries = 3;
   
    template.update("INSERT INTO hts_idkey VALUES (?,?,?)",
        501, "TICKER", "V501");
    template.update("INSERT INTO hts_idkey VALUES (?,?,?)",
        502, "NASDAQ", "V502");
    template.update("INSERT INTO hts_idkey VALUES (?,?,?)",
        503, "TICKER", "V503");
    template.update("INSERT INTO hts_idkey VALUES (?,?,?)",
        504, "NASDAQ", "V504");
    template.update("INSERT INTO hts_idkey VALUES (?,?,?)",
        505, "TICKER", "V505");
    template.update("INSERT INTO hts_idkey VALUES (?,?,?)",
        506, "NASDAQ", "V506");
   
    template.update("INSERT INTO hts_doc2idkey (id, doc_id, idkey_id, valid_from, valid_to) VALUES (?,?,?,?,?)",
        1, 101, 501, DbDateUtils.MIN_SQL_DATE, DbDateUtils.MAX_SQL_DATE);
    template.update("INSERT INTO hts_doc2idkey (id, doc_id, idkey_id, valid_from, valid_to) VALUES (?,?,?,?,?)",
        2, 101, 502, DbDateUtils.MIN_SQL_DATE, DbDateUtils.MAX_SQL_DATE);
    template.update("INSERT INTO hts_doc2idkey (id, doc_id, idkey_id, valid_from, valid_to) VALUES (?,?,?,?,?)",
        3, 102, 503, DbDateUtils.MIN_SQL_DATE, DbDateUtils.MAX_SQL_DATE);
    template.update("INSERT INTO hts_doc2idkey (id, doc_id, idkey_id, valid_from, valid_to) VALUES (?,?,?,?,?)",
        4, 102, 504, DbDateUtils.toSqlDate(LocalDate.of(2011, 6, 30)), DbDateUtils.MAX_SQL_DATE);
    template.update("INSERT INTO hts_doc2idkey (id, doc_id, idkey_id, valid_from, valid_to) VALUES (?,?,?,?,?)",
        5, 201, 505, DbDateUtils.MIN_SQL_DATE, DbDateUtils.MAX_SQL_DATE);
    template.update("INSERT INTO hts_doc2idkey (id, doc_id, idkey_id, valid_from, valid_to) VALUES (?,?,?,?,?)",
        6, 201, 506, DbDateUtils.MIN_SQL_DATE, DbDateUtils.MAX_SQL_DATE);
    template.update("INSERT INTO hts_doc2idkey (id, doc_id, idkey_id, valid_from, valid_to) VALUES (?,?,?,?,?)",
        7, 202, 505, DbDateUtils.MIN_SQL_DATE, DbDateUtils.MAX_SQL_DATE);
    template.update("INSERT INTO hts_doc2idkey (id, doc_id, idkey_id, valid_from, valid_to) VALUES (?,?,?,?,?)",
        8, 202, 506, DbDateUtils.MIN_SQL_DATE, DbDateUtils.MAX_SQL_DATE);
    template.update("INSERT INTO hts_doc2idkey (id, doc_id, idkey_id, valid_from, valid_to) VALUES (?,?,?,?,?)",
        9, 203, 505, DbDateUtils.MIN_SQL_DATE, DbDateUtils.MAX_SQL_DATE);
    template.update("INSERT INTO hts_doc2idkey (id, doc_id, idkey_id, valid_from, valid_to) VALUES (?,?,?,?,?)",
        10, 203, 506, DbDateUtils.MIN_SQL_DATE, DbDateUtils.MAX_SQL_DATE);
   
    template.update("INSERT INTO hts_point VALUES (?,?,?,?,?)",
        101, DbDateUtils.toSqlDate(LocalDate.of(2011, 1, 1)), toSqlTimestamp(_version1Instant), toSqlTimestamp(_version1Instant), 3.1d);
    template.update("INSERT INTO hts_point VALUES (?,?,?,?,?)",
        101, DbDateUtils.toSqlDate(LocalDate.of(2011, 1, 2)), toSqlTimestamp(_version2Instant), toSqlTimestamp(_version2Instant), 3.2d);
    template.update("INSERT INTO hts_point VALUES (?,?,?,?,?)",
        101, DbDateUtils.toSqlDate(LocalDate.of(2011, 1, 3)), toSqlTimestamp(_version2Instant), toSqlTimestamp(_version2Instant), 3.3d);
    template.update("INSERT INTO hts_point VALUES (?,?,?,?,?)",
        101, DbDateUtils.toSqlDate(LocalDate.of(2011, 1, 2)), toSqlTimestamp(_version2Instant), toSqlTimestamp(_version3Instant), 3.21d);
    template.update("INSERT INTO hts_point VALUES (?,?,?,?,?)",
        101, DbDateUtils.toSqlDate(LocalDate.of(2011, 1, 2)), toSqlTimestamp(_version2Instant), toSqlTimestamp(_version4Instant), 3.22d);
    template.update("INSERT INTO hts_point VALUES (?,?,?,?,?)",
        101, DbDateUtils.toSqlDate(LocalDate.of(2011, 1, 3)), toSqlTimestamp(_version2Instant), toSqlTimestamp(_version4Instant), 3.33d);
  }
View Full Code Here

    _version2Instant = now.minusSeconds(50);
    s_logger.debug("test data now:   {}", _version1Instant);
    s_logger.debug("test data later: {}", _version2Instant);
    FudgeContext fudgeContext = OpenGammaFudgeContext.getInstance();
    LobHandler lobHandler = new DefaultLobHandler();
    final JdbcOperations template = _exgMaster.getDbConnector().getJdbcOperations();
    ManageableExchange exchange = new ManageableExchange();
    exchange.setUniqueId(UniqueId.of("DbExg", "101", "0"));
    exchange.setExternalIdBundle(ExternalIdBundle.of(ExternalId.of("A", "B"), ExternalId.of("C", "D"), ExternalId.of("E", "F")));
    exchange.setName("TestExchange101");
    exchange.setTimeZone(ZoneId.of("Europe/London"));
    byte[] bytes = fudgeContext.toByteArray(fudgeContext.toFudgeMsg(exchange).getMessage());
    template.update("INSERT INTO exg_exchange VALUES (?,?,?,?,?, ?,?,?,?)",
        101, 101, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP,
        "TestExchange101", "Europe/London", new SqlParameterValue(Types.BLOB, new SqlLobValue(bytes, lobHandler)));
    exchange.setUniqueId(UniqueId.of("DbExg", "102", "0"));
    exchange.setExternalIdBundle(ExternalIdBundle.of(ExternalId.of("A", "B"), ExternalId.of("C", "D"), ExternalId.of("G", "H")));
    exchange.setName("TestExchange102");
    exchange.setTimeZone(ZoneId.of("Europe/Paris"));
    bytes = fudgeContext.toByteArray(fudgeContext.toFudgeMsg(exchange).getMessage());
    template.update("INSERT INTO exg_exchange VALUES (?,?,?,?,?, ?,?,?,?)",
        102, 102, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP,
        "TestExchange102", "Europe/Paris", new SqlParameterValue(Types.BLOB, new SqlLobValue(bytes, lobHandler)));
    exchange.setUniqueId(UniqueId.of("DbExg", "201", "0"));
    exchange.setExternalIdBundle(ExternalIdBundle.of(ExternalId.of("C", "D"), ExternalId.of("E", "F")));
    exchange.setName("TestExchange201");
    exchange.setTimeZone(ZoneId.of("Asia/Tokyo"));
    bytes = fudgeContext.toByteArray(fudgeContext.toFudgeMsg(exchange).getMessage());
    template.update("INSERT INTO exg_exchange VALUES (?,?,?,?,?, ?,?,?,?)",
        201, 201, toSqlTimestamp(_version1Instant), toSqlTimestamp(_version2Instant), toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP,
        "TestExchange201", "Asia/Tokyo", new SqlParameterValue(Types.BLOB, new SqlLobValue(bytes, lobHandler)));
    exchange.setUniqueId(UniqueId.of("DbExg", "201", "1"));
    exchange.setExternalIdBundle(ExternalIdBundle.of(ExternalId.of("C", "D"), ExternalId.of("E", "F")));
    exchange.setName("TestExchange202");
    exchange.setTimeZone(ZoneId.of("Asia/Tokyo"));
    bytes = fudgeContext.toByteArray(fudgeContext.toFudgeMsg(exchange).getMessage());
    template.update("INSERT INTO exg_exchange VALUES (?,?,?,?,?, ?,?,?,?)",
        202, 201, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP,
        "TestExchange202", "Asia/Tokyo", new SqlParameterValue(Types.BLOB, new SqlLobValue(bytes, lobHandler)));
    _totalExchanges = 3;
//  id bigint not null,
//  key_scheme varchar(255) not null,
//  key_value varchar(255) not null,
    template.update("INSERT INTO exg_idkey VALUES (?,?,?)",
        1, "A", "B");
    template.update("INSERT INTO exg_idkey VALUES (?,?,?)",
        2, "C", "D");
    template.update("INSERT INTO exg_idkey VALUES (?,?,?)",
        3, "E", "F");
    template.update("INSERT INTO exg_idkey VALUES (?,?,?)",
        4, "G", "H");
//  exchange_id bigint not null,
//  idkey_id bigint not null,
    template.update("INSERT INTO exg_exchange2idkey VALUES (?,?)",
        101, 1);
    template.update("INSERT INTO exg_exchange2idkey VALUES (?,?)",
        101, 2);
    template.update("INSERT INTO exg_exchange2idkey VALUES (?,?)",
        101, 3);
    template.update("INSERT INTO exg_exchange2idkey VALUES (?,?)",
        102, 1);
    template.update("INSERT INTO exg_exchange2idkey VALUES (?,?)",
        102, 2);
    template.update("INSERT INTO exg_exchange2idkey VALUES (?,?)",
        102, 4);
    template.update("INSERT INTO exg_exchange2idkey VALUES (?,?)",
        201, 2);
    template.update("INSERT INTO exg_exchange2idkey VALUES (?,?)",
        201, 3);
    template.update("INSERT INTO exg_exchange2idkey VALUES (?,?)",
        202, 2);
    template.update("INSERT INTO exg_exchange2idkey VALUES (?,?)",
        202, 3);
  }
View Full Code Here

    _version1Instant = now.minusSeconds(100);
    _version2Instant = now.minusSeconds(50);
    s_logger.debug("test data now:   {}", _version1Instant);
    s_logger.debug("test data later: {}", _version2Instant);

    final JdbcOperations template = _orgMaster.getDbConnector().getJdbcOperations();

//    id bigint NOT NULL,
//    oid bigint NOT NULL,
//    ver_from_instant timestamp without time zone NOT NULL,
//        ver_to_instant timestamp without time zone NOT NULL,
//    corr_from_instant timestamp without time zone NOT NULL,
//        corr_to_instant timestamp without time zone NOT NULL,
//    provider_scheme varchar(255),
//        provider_value varchar(255),
//
//        obligor_short_name                           varchar(255) NOT NULL,
//    obligor_red_code                             varchar(255) NOT NULL,
//    obligor_ticker                               varchar(255) NOT NULL,
//    obligor_country                              varchar(255) NOT NULL,
//    obligor_region                               varchar(255) NOT NULL,
//    obligor_sector                               varchar(255) NOT NULL,
//    obligor_composite_rating                     varchar(255) NOT NULL,
//    obligor_implied_rating                       varchar(255) NOT NULL,
//    obligor_fitch_credit_rating                  varchar(255) NOT NULL,
//    obligor_moodys_credit_rating                 varchar(255) NOT NULL,
//    obligor_standard_and_poors_credit_rating     varchar(255) NOT NULL,
//    obligor_has_defaulted                        smallint NOT NULL,
//
    template.update("INSERT INTO org_organisation VALUES (?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?)",
                    101,
                    101,
                    toSqlTimestamp(_version1Instant),
                    MAX_SQL_TIMESTAMP,
                    toSqlTimestamp(_version1Instant),
                    MAX_SQL_TIMESTAMP,
                    PROVIDER_SCHEME,
                    "1",
                    "TestOrganization101",
                    "RED_code_101",
                    "ticker_101",
                    "CountryA",
        Region.AFRICA.name(),
        Sector.BASICMATERIALS.name(),
        CreditRating.A.name(),
        CreditRating.A.name(),
        CreditRatingFitch.A.name(),
        CreditRatingMoodys.A.name(),
        CreditRatingStandardAndPoors.A.name(),
        0);
    template.update("INSERT INTO org_organisation VALUES (?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?)",
                    102,
                    102,
                    toSqlTimestamp(_version1Instant),
                    MAX_SQL_TIMESTAMP,
                    toSqlTimestamp(_version1Instant),
                    MAX_SQL_TIMESTAMP,
                    PROVIDER_SCHEME,
                    "2",
                    "TestOrganization102",
                    "RED_code_102",
                    "ticker_102",
                    "CountryB",
        Region.AFRICA.name(),
        Sector.BASICMATERIALS.name(),
        CreditRating.A.name(),
        CreditRating.A.name(),
        CreditRatingFitch.A.name(),
        CreditRatingMoodys.A.name(),
        CreditRatingStandardAndPoors.A.name(),
        0);

    template.update("INSERT INTO org_organisation VALUES (?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?)",
                    201,
                    201,
                    toSqlTimestamp(_version1Instant),
        toSqlTimestamp(_version2Instant),
        toSqlTimestamp(_version1Instant),
                    MAX_SQL_TIMESTAMP,
                    PROVIDER_SCHEME,
                    "3",
                    "TestOrganization201",
                    "RED_code_201",
                    "ticker_201",
                    "CountryC",
        Region.AFRICA.name(),
        Sector.BASICMATERIALS.name(),
        CreditRating.A.name(),
        CreditRating.A.name(),
        CreditRatingFitch.A.name(),
        CreditRatingMoodys.A.name(),
        CreditRatingStandardAndPoors.A.name(),
        0);
    template.update("INSERT INTO org_organisation VALUES (?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?)",
                    202,
                    201,
                    toSqlTimestamp(_version2Instant),
                    MAX_SQL_TIMESTAMP,
                    toSqlTimestamp(_version2Instant),
View Full Code Here

    _posMaster.setClock(Clock.fixed(_now.toInstant(), ZoneOffset.UTC));
    _version1Instant = _now.toInstant().minusSeconds(100);
    _version2Instant = _now.toInstant().minusSeconds(50);
    s_logger.debug("test data now:   {}", _version1Instant);
    s_logger.debug("test data later: {}", _version2Instant);
    final JdbcOperations template = _posMaster.getDbConnector().getJdbcOperations();
    template.update("INSERT INTO pos_position VALUES (?,?,?,?,?, ?,?,?,?)",
        100, 100, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "A", "100", BigDecimal.valueOf(100.987));
    template.update("INSERT INTO pos_position VALUES (?,?,?,?,?, ?,?,?,?)",
        120, 120, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "A", "120", BigDecimal.valueOf(120.987));
    template.update("INSERT INTO pos_position VALUES (?,?,?,?,?, ?,?,?,?)",
        121, 121, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "A", "121", BigDecimal.valueOf(121.987));
    template.update("INSERT INTO pos_position VALUES (?,?,?,?,?, ?,?,?,?)",
        122, 122, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "A", "122", BigDecimal.valueOf(122.987));
    template.update("INSERT INTO pos_position VALUES (?,?,?,?,?, ?,?,?,?)",
        123, 123, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "A", "123", BigDecimal.valueOf(123.987));
    template.update("INSERT INTO pos_position VALUES (?,?,?,?,?, ?,?,?,?)",
        221, 221, toSqlTimestamp(_version1Instant), toSqlTimestamp(_version2Instant), toSqlTimestamp(_version1Instant), MAX_SQL_TIMESTAMP, "A", "221", BigDecimal.valueOf(221.987));
    template.update("INSERT INTO pos_position VALUES (?,?,?,?,?, ?,?,?,?)",
        222, 221, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, "A", "222", BigDecimal.valueOf(222.987));
    _totalPositions = 6;

    template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
        500, "TICKER", "S100");
    template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
        501, "TICKER", "T130");
    template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
        502, "TICKER", "MSFT");
    template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
        503, "NASDAQ", "Micro");
    template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
        504, "TICKER", "ORCL");
    template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
        505, "TICKER", "ORCL134");
    template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
        506, "NASDAQ", "ORCL135");
    template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
        507, "TICKER", "IBMC");
    template.update("INSERT INTO pos_idkey VALUES (?,?,?)",
        508, "OID", "DbSec~1234");

    template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 100, 500);
    template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 120, 501);
    template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 121, 502);
    template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 121, 503);
    template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 122, 504);
    template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 123, 505);
    template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 123, 506);
    template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 221, 507);
    template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 222, 507);
    template.update("INSERT INTO pos_position2idkey VALUES (?,?)", 222, 508);

    OffsetTime tradeTime = _now.toOffsetTime().minusSeconds(400);
    template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
        "VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
        400, 400, 120, 120, BigDecimal.valueOf(120.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "C100", "B", "400");
    tradeTime = _now.toOffsetTime().minusSeconds(401);
    template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
        "VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
        401, 401, 121, 121, BigDecimal.valueOf(121.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "C101", "B", "401");
    tradeTime = _now.toOffsetTime().minusSeconds(402);
    template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
        "VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
        402, 402, 122, 122, BigDecimal.valueOf(100.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "JMP", "B", "402");
    tradeTime = _now.toOffsetTime().minusSeconds(403);
    template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
        "VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
        403, 403, 122, 122, BigDecimal.valueOf(22.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "CISC", "B", "403");
    tradeTime = _now.toOffsetTime().minusSeconds(404);
    template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
        "VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
        404, 404, 123, 123, BigDecimal.valueOf(100.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "C104", "B", "404");
    tradeTime = _now.toOffsetTime().minusSeconds(405);
    template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
        "VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
        405, 405, 123, 123, BigDecimal.valueOf(200.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "C105", "B", "405");
    tradeTime = _now.toOffsetTime().minusSeconds(406);
    template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
        "VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
        406, 406, 123, 123, BigDecimal.valueOf(300.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "C106", "B", "406");
    tradeTime = _now.toOffsetTime().minusSeconds(407);
    template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
        "VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
        407, 407, 221, 221, BigDecimal.valueOf(221.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "C221", "B", "407");
    tradeTime = _now.toOffsetTime().minusSeconds(408);
    template.update("INSERT INTO pos_trade (id, oid, position_id, position_oid, quantity, trade_date, trade_time, zone_offset, cparty_scheme, cparty_value, provider_scheme, provider_value) " +
        "VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
        408, 407, 222, 221, BigDecimal.valueOf(222.987), toSqlDate(_now.toLocalDate()), toSqlTimestamp(tradeTime.toLocalTime()), tradeTime.getOffset().getTotalSeconds(), "CPARTY", "C222", "B", "408");

    template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 400, 501);
    template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 401, 502);
    template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 401, 503);
    template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 402, 504);
    template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 403, 504);
    template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 404, 505);
    template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 404, 506);
    template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 405, 505);
    template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 405, 506);
    template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 406, 505);
    template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 406, 506);
    template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 407, 507);
    template.update("INSERT INTO pos_trade2idkey VALUES (?,?)", 408, 507);
  }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.JdbcOperations

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.