Spring 2.5 mess

I did it. In my very big project I switched from spring 2.0.8 to 2.5. And it happened: An ugly exception „org.hibernate.HibernateException: createQuery is not valid without active transaction“ killed my joy.

I checked my code, refactored some, reconfigured my applicationContext: Nothing. After several lost hours I found a report on this issue: jira.springframework.org/browse/SPR-3912.

It came out, that since spring 2.5 the handling of the SessionFactory of hibernate changed. While 2.0 ignored any „misconfigured“ hibernate properties, the 2.5 was very strict.
In the end I just had to remove „<property name=“current_session_context_class“>thread</property>“, so the spring internal handling of the context could work as usual.

Unfortunately there was no note in the online spring documentations about this changed behaviour.
Although the spring documentation is great, compared to other open and commercial apis, it would not be amiss if they added some notes about such behaviour changes to it.

Leave a Reply »»

Note: All comments are manually approved to avoid spam. So if your comment doesn't appear immediately, that's ok. Have patience, it can take some days until I have the time to approve my comments.