DummyTransactionManager.INSTANCE.getTransaction().commit();
// First, test partially scrolling the result with out closing
DummyTransactionManager.INSTANCE.begin();
s = getSessions().getCurrentSession();
ScrollableResults results = s.createQuery( "from Item" ).scroll();
results.next();
DummyTransactionManager.INSTANCE.getTransaction().commit();
// Next, test partially scrolling the result with closing
DummyTransactionManager.INSTANCE.begin();
s = getSessions().getCurrentSession();
results = s.createQuery( "from Item" ).scroll();
results.next();
results.close();
DummyTransactionManager.INSTANCE.getTransaction().commit();
// Next, scroll the entire result (w/o closing)
DummyTransactionManager.INSTANCE.begin();
s = getSessions().getCurrentSession();
results = s.createQuery( "from Item" ).scroll();
while ( results.next() ) {
// do nothing
}
DummyTransactionManager.INSTANCE.getTransaction().commit();
// Next, scroll the entire result (closing)
DummyTransactionManager.INSTANCE.begin();
s = getSessions().getCurrentSession();
results = s.createQuery( "from Item" ).scroll();
while ( results.next() ) {
// do nothing
}
results.close();
DummyTransactionManager.INSTANCE.getTransaction().commit();
DummyTransactionManager.INSTANCE.begin();
s = getSessions().getCurrentSession();
s.createQuery( "delete from Item" ).executeUpdate();