/** * 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"); }