public void XtestCountAndIterator() throws Exception {
    Transaction tx = session.beginTransaction();
    session.save(new Simple(1, "test1"));
    session.save(new Simple(2, "test2"));
    tx.commit();

    session.flush();
    session.close();
    SQLQuery<Simple> sql = new SQLQuery<Simple>(Simple.class, "id = ?");
    sql.setParameter(1, 1);
    DataIterator it = sqlDataProvider.iterator(sql);
    assertTrue(it.hasNext());
    assertEquals(1, ((Simple) it.next()).getId().intValue());

    it.close();
    sql.setParameter(1, 0);
    it = sqlDataProvider.iterator(sql);
    assertFalse(it.hasNext());
    it.close();
  }
  @Override
  protected PeriodTimerEvent processEvent(PeriodTimerEvent event) {

    long end = event.getTime();
    query.setParameters(end - getInterval() * 1000L, end);

    MarketDataEvent[] ticks = gigaSpace.readMultiple(query, Integer.MAX_VALUE, ReadModifiers.FIFO);

    if (ticks.length == 0) return null;

    Map<String, VwapData> calcdata = new HashMap<String, VwapData>();

    for (MarketDataEvent tick : ticks) {
      VwapData data = calcdata.get(tick.getSymbol());
      if (data == null) {
        data = new VwapData();
        data.symbol = tick.getSymbol();
        calcdata.put(data.symbol, data);
      }
      data.totalvol = data.totalvol + tick.getTradeData().getVolume();
      data.pricecum =
          data.pricecum
              + (tick.getTradeData().getPrice() * (double) tick.getTradeData().getVolume());
    }

    // Create synthetic events
    for (VwapData vd : calcdata.values()) {
      MarketDataEvent newevent = new MarketDataEvent();
      newevent.setEventTime(event.getTime());
      newevent.setEventType(getName());
      newevent.setSymbol(vd.symbol);
      VwapEventData ved = new VwapEventData();
      ved.setVwap(vd.pricecum / vd.totalvol);
      ved.setPeriod(event.getInterval());
      newevent.setSynthData(ved);
      log.info("data:" + ved.toString());
      gigaSpace.write(newevent);
    }
    return null;
  }