Hibernate 3.3 Upgrade Tips

I recently upgraded one of our applications from Hibernate 3.2 to Hibernate 3.3, which was released as GA on August 15, 2008. While performing the upgrade, I ran into a couple of issues that needed to be addressed before my application was up and running on the new version. The first two issues I encountered were caused by not having some required JARs on the classpath.

Steven Merrill, Director of Devops
#Development | Posted

I recently upgraded one of our applications from Hibernate 3.2 to Hibernate 3.3, which was released as GA on August 15, 2008. While performing the upgrade, I ran into a couple of issues that needed to be addressed before my application was up and running on the new version. The first two issues I encountered were caused by not having some required JARs on the classpath. Though the first mistake was a stupid one on my part, it is necessary to have the 3.1 release of Apache Commons Collections.I recently upgraded one of our applications from Hibernate 3.2 to Hibernate 3.3, which was released as GA on August 15, 2008.

While performing the upgrade, I ran into a couple of issues that needed to be addressed before my application was up and running on the new version. The first two issues I encountered were caused by not having some required JARs on the classpath. Though the first mistake was a stupid one on my part, it is necessary to have the 3.1 release of Apache Commons Collections.

I was already using an older version of the library in my application, but it was necessary to upgrade to that version as Hibernate is using some of the newer collection classes. Secondly, with the transition away from Commons Logging and to SLF4J, I also had to download and include the log4j implementation of SLF4J in my classpath.

(Obviously, you just need to grab the implementation that matches your preferred method of logging and not necessarily log4j.) While those two issues showed up immediately and were fairly easy to track down, I also started having problems with my JDBC connections becoming stale in my connection pool.

After turning my debugging up to INFO level, I discovered that Hibernate had decided to stop using C3P0 for connection pooling and was instead falling back to its own connection pooling. I found a couple of other people with the same problem, and it turns out that the instructions on Hibernate’s website for using C3P0 are not accurate for 3.3.

Apparently Hibernate used to take the presence of the hibernate.c3p0.max_size property as an indication that the user wanted to use C3P0. However, now the connection.provider_class property must be set to org.hibernate.connection.C3P0ConnectionProvider. Adding this property to my configuration file got Hibernate back to using C3P0 and fixed my connection pooling problems.

Finally, while doing a little research for this blog post, I discovered that Hibernate released 3.3 SP1 on August 20, 2008. So, if you grabbed the GA release in the first few days it was out there, you probably want to go back and download the service pack release, which addresses the breaking of a public API as documented in HHH-3437.

Steven Merrill

Director of Devops