Quote:
flush will execute any outstanding SQL operations only. No transaction state changes.
I'm sorry, but the reply above is not very clear to me.
If I perform a session.flush() which causes SQL for an earlier session.save() to get executed. And then I explicitely rollback the transaction, will the SQL executed on flush also be rolled back?
In other words ..
Code:
Session s = sessionFactory.openSession();
Transaction tx = s.beginTransaction();
s.save(objA);
s.flush();
tx.rollback();
s.close();
Will 'objA' get saved to the database?
Also, if instead of rolling back the transaction, I simply close my session
without committing, will the SQL executed on flush be rolled back?
Again ..
Code:
Session s = sessionFactory.openSession();
Transaction tx = s.beginTransaction();
s.save(objA);
s.flush();
s.close(); // close session without committing or rolling back
Will 'objA' get saved to the database?
Thanks, Rishabh