Tonight I just completed the upgrade from Spring 1.2 and Hibernate 3.1 to Spring 2.0 and Hibernate 3.2 for work. I was expecting a rough upgrade but was pleasantly surprised how easily it went.
Our entire unit and integration test suite which hits Spring and Hibernate pretty good runs in about the same amount of time so there doesn’t appear to be any significant performance penalty or improvement with the upgrade.
I had one minor problem and it was that we connect to multiple databases so we have multiple session factories that interact with EhCache. Hibernates org.hibernate.cache.EhCacheProvider now expects one configuration per sesssion factory which I wasn’t too excited about given we have 51 databases (1 database per state plus Washington DC) and it’s been working fine for 2 years with one cache provider. The problem caused this exception:
Invocation of init method failed; nested exception is java.lang.NullPointerException [java] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'surveysSessionFactory' defined in class path resource [gs/data/dao/hibernate/applicationContext-hibernate.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException [java] Caused by: java.lang.NullPointerException [java] at net.sf.ehcache.CacheManager.detectAndFixDiskStorePathConflict(CacheManager.java:269) ...
However, I wasn’t the only person who had this problem so a quick search turned up that EhCache now offers the net.sf.ehcache.hibernate.SingletonEhCacheProvider and switching the hibernate.cache.provider_class property to this new provider solved the problem and allows us to continue using a single cache provider.