Hello,
I just tried upgrading our web application from spring 1.2.2 to 2.0.6, but I started getting strange database access errors. I did some digging and found the source of my problem.
We are using hibernate 3.2.2, and have the hibernate.connection.release_mode explicitly set to on_close because we require the same connection to be used for an entire hibernate session (we do some custom connection preparation when opening the session).
In HibernateTransactionManager.doCleanupAfterCompleti on, I found this near the end (in the cleanup of a pre-bound hibernate session that is not closed):
This does not seem to honor the on_close connection release mode. The hibernate session is not being closed, yet the connection is being closed here.Code:// Running against Hibernate 3.1+... // Let's explicitly disconnect the Session to provide efficient Connection handling // even with connection release mode "on_close". The Session will automatically // obtain a new Connection in case of further database access. // Couldn't do this on Hibernate 3.0, where disconnect required a manual reconnect. session.disconnect();
1. Why it was done this way?
2. Is there some way (that I have missed) to get the old behavior back to ensure my hibernate session retains the same connection until the session is closed?
Thanks,
Joe


Reply With Quote