Hi,
I experimented a bit with hibernate and have some strange behaviour on rollback:
Transaction hibernateTransaction = hibernateSession.beginTransaction();
Employee employee = new Employee();
// initialize employee here
hibernateSession.save(employee);
hibernateTransaction.commit();
Iterator iter = hibernateSession.iterate("from " + Employee.class.getName()");
while ( iter.hasNext() ) {
System.out.println("found after commit" + iter.next());
}
hibernateSession.delete(employee);
//hibernateSession.flush();
hibernateTransaction.rollback();
iter = hibernateSession.iterate("from " + Employee.class.getName());
while ( iter.hasNext() ) {
System.out.println("found after rollback " + iter.next());
}
A employee is saved and commited. A delete is done, but rollbacked. However, the created employee is not found in the query. If I uncomment the flush, it works as expected.
I use hibernate 2.0.3
Armin
|