示例#1
0
 private static Connection createConnection() {
   Connection con = new ConnectionNonClosing(DatabaseCreator.nextConnection());
   Database db = Database.from(con);
   // insert another 1000 people
   db.update("insert into person(name, score) values(?,?)")
       .parameters(
           Observable.range(1, 1000)
               .concatMap(
                   new Func1<Integer, Observable<Object>>() {
                     @Override
                     public Observable<Object> call(Integer n) {
                       return Observable.<Object>just("person" + n, n);
                     }
                   }));
   return con;
 }
示例#2
0
  public StoreThread(
      int year,
      DatabaseCreator databaseCreator,
      Map<Integer, Double> normalizedTravelZoneAverageTripsTime,
      Map<Integer, int[]> occupancyRate,
      List<String[]> timeplanOutputArrayList,
      List<String[]> linkDelayOutputArrayList,
      List<String[]> testImmigrants,
      List<String[]> testEmigrants,
      List<String[]> testEquity,
      List<String[]> testNotrelocHhold,
      List<String[]> testRelocHhold,
      List<String[]> testSPAfterReloc,
      List<String[]> deadPeople,
      List<String[]> newborns,
      List<String[]> travModeChoice) {

    super();
    this.databaseCreator = databaseCreator;
    this.jdbcTemplate = databaseCreator.getJdbcTemplate();
    transactionManager =
        (DataSourceTransactionManager) ApplicationContextHolder.getBean("transactionManagerOutput");
    this.year = year;
    this.normalizedTravelZoneAverageTripsTime = normalizedTravelZoneAverageTripsTime;
    this.occupancyRate = occupancyRate;
    this.timeplanOutputArrayList = timeplanOutputArrayList;
    this.linkDelayOutputArrayList = linkDelayOutputArrayList;
    this.testImmigrants = testImmigrants;
    this.testEmigrants = testEmigrants;
    this.testEquity = testEquity;
    this.testNotRelocHhold = testNotrelocHhold;
    this.testRelocHhold = testRelocHhold;
    this.testSPAfterReloc = testSPAfterReloc;
    this.deadPeople = deadPeople;
    this.newborns = newborns;
    this.travelModeChoiceOutput = travModeChoice;
  }