recently had a problem while using MySql with Hibernate in a Java app. Everyone and his dog had elaborate answers on this issue, including changing your connection pool settings, rewriting your entire codebase, and rebuilding the Space Shuttle. The answer was simple. You need to close out the session factory, not just the Session. This is done with this line:

fact.close();

Assuming you named it fact like this:

SessionFactory fact = new Configuration().configure().buildSessionFactory();

Which probably would have saved a lot of trouble for most of those developers. A lot of the examples on the internet excluded this simple answer.

Leave a Reply

Your email address will not be published. Required fields are marked *