Sridhar Santhanakrishnan wrote:When you comment the line and run the application, are the changes saved to the database when the transaction is commited?
This will not demonstrate whether the session was closed.
It depends on your sesison management configuration. If you have an interceptor or use transaction scoped sessions then commiting the transaction will close the session (assuming you did not open it explicitly in your transaction and instead used the current session). If you don't then it wont.
When you say session.commit() -- if any CRUD operation performed on a row; then that particular transaction after the CRUD operation will be committed in the DB.
When you say session.close() -- the session will be closed instantly.
May be you might have accessed any relevant code pertaining to that session after saying session.close();
Do you want ants? Because that's how you get ants. And a tiny ads:
Devious Experiments for a Truly Passive Greenhouse!