Welcome

A Small Silly Reminder For Unclosed Session Warning of Hibernate

If you suddenly get a warning, saying that ?unclosed connection, forgot to call close() on your Session? from Hibernate and you employ OpenSessionInViewFilter to manage your Hibernate sessions, check that your OpenSessionInViewFilter?s filter mapping in web.xml comes before any other filter mappings, for example Acegi Security Filters, especially! Because, those other mappings may trigger some database operations depending on Hibernate session, and if there is no open one, they will probably open, and again most probably left open it, as normally it is the job of OpenSessionInViewFilter to close Hibernate sessions at the end of the response. Just a silly reminder!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.