It depends on the version of spring but in general messing around with that property whilst using Spring must be avoided (unless you use JTA for transactions then you need to configure this).
As of Hibernate 3.1 there is something called contextual sessions and for that hibernate provides the CurrentSessionContext
interface. There are several implementations for this (and thread
is short for ThreadLocalSessionContext
). Spring has its own implementation of this interface the SpringSessionContext
class.
Spring by default sets the property to Springs implementation of the CurrentSessionContext
, when this is set to something else (other then JTA) this will break springs ability to manage the hibernate session (and thus the transaction).
Now in older versions of spring (and I assume you also upgraded Spring to be able to use hibernate) combined with hibernate 3 there was some other trickery involved regarding getting the session (due to backwards compatibility with older 3.x versions of hibernate). This made Spring less depended on the value of that property. (Spring created a proxy for the SessionFactory
and basically intercepted the getSession
method to be able to manage the session).