/**
   * read in all the PerformanceArticles from the RDBMS that have been inserted by <code>
   * insertNewArticles()</code>. The lookup is done with a cursor fetch, that is: a between
   * Statement is used to select all inserted PerformanceArticles and Objects are read in by
   * fetching from the cursor (JDBC ResultSet).
   */
  protected void readArticlesByCursor() throws Exception {
    TransactionExt tx = (TransactionExt) odmg.newTransaction();
    // we don't want implicite locks when compare performance
    tx.setImplicitLocking(false);
    tx.begin();
    // clear cache to read from DB
    tx.getBroker().clearCache();

    long start = System.currentTimeMillis();
    OQLQuery query = odmg.newOQLQuery();
    String sql =
        "select allArticles from "
            + PerformanceArticle.class.getName()
            + " where articleId between "
            + new Integer(offsetId)
            + " and "
            + new Integer(offsetId + articleCount);
    query.create(sql);
    ManageableCollection collection = (ManageableCollection) query.execute();
    Iterator iter = collection.ojbIterator();
    int fetchCount = 0;
    while (iter.hasNext()) {
      fetchCount++;
      iter.next();
    }
    long stop = System.currentTimeMillis();
    logger.info("fetching " + fetchCount + " Objects: " + (stop - start) + " msec");
  }
 /**
  * read in all the PerformanceArticles from the RDBMS that have been inserted by <code>
  * insertNewArticles()</code>. The lookup is done one by one, that is: a primary key based lookup
  * is used.
  */
 protected void readArticles() throws Exception {
   TransactionExt tx = (TransactionExt) odmg.newTransaction();
   // we don't want implicite locks when compare performance
   tx.setImplicitLocking(false);
   String sql =
       "select allArticles from " + PerformanceArticle.class.getName() + " where articleId=$1";
   long start = System.currentTimeMillis();
   tx.begin();
   for (int i = 0; i < articleCount; i++) {
     OQLQuery query = odmg.newOQLQuery();
     query.create(sql);
     query.bind(arr[i].getArticleId());
     query.execute();
   }
   tx.commit();
   long stop = System.currentTimeMillis();
   logger.info("querying " + articleCount + " Objects: " + (stop - start) + " msec");
 }