Friday, December 21, 2007

Spring 2.5 Upgrade

I upgraded out platform infrastructure to Spring 2.5 this morning. It was pretty straight-forward, although I had one painful issue. For any of our tests that use Hibernate, I was getting the following error:

Caused by: org.hibernate.HibernateException: saveOrUpdate is not valid without active transaction
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
at $Proxy39.saveOrUpdate(Unknown Source)


After a bit of digging, I realized we had the following Hibernate property set:

<prop key="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</prop>

Basically, this was preventing Spring from managing the transaction context correctly. Once I removed it, all of our tests passed. I wonder if this is the reason why we've had some problems with NOT_SUPPORTED and SUPPORTS previously. This will require some additional testing...

No comments: