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