Mar 30th, 2005, 10:14 AM
HibernateTransactionManager & doSuspend()
I am new to Spring and to Hibernate and amusing the following versions of each:
I have a application where one method met1() (with a declarative transaction definition of PROPAGATION_REQUIRES_NEW) invokes another method met2() (with a declarative transaction definition of PROPAGATION_REQUIRES_NEW). When the call is made to met2(), as the transaction definition specifies that a new transaction be created, a call is made to the suspend() method on the AbstractPlatformTransactionManager to suspend the existing transaction. This in turn calls the doSuspend() method of the HibernateTransactionManager class (as expected) which unbinds the SessionHolder and ConnectionHolder resources from the ThreadLocal via the TransactionSynchronizationManager. The list of SpringSessionSynchronization objects are then retrieved from the TransactionSynchronizationManager if the isSynchronizationActive flag is true, and call is made to suspend the resources returned on this list. A IllegalStateException is then thrown at this stage as the resources are not on the ThreadLocal to be removed.
Is it incorrect to be calling a PROPAGATION_REQUIRES_NEW method FROM a PROPAGATION_REQUIRES_NEW method?
Is the above behaviour correct or should a call be made to clearSynchronization() from the doSuspend() method on the HibernateTransactionManager? If so, has it been fixed in a later version of Spring?
If anyone could give me help with this, I would greatly appreciate it.