Oct 8th, 2009, 09:08 AM
TopLinkTransactionManager doesn't suspend ConnectionHolder synchronization
I'm using TopLinkTransactionManager (from spring-orm-2.5.6.jar) in a configuration scenario which lets me share transactions between TopLink Session and plain JDBC code (the same DataSource). Everything works perfectly fine until i need to open a completely new transaction within a running one (by setting transaction propagation property to REQUIRES_NEW value). In doBegin method TopLinkTransactionManager tries to bind new ConnectionHolder to DataSource but it fails. The reason is that in doSuspend method (which suspends resources of current transction) only SessionHolder is unbound from thread. ConnectionHolder is still bound to DataSource so we get an error trying to open new transaction in doBegin method.
I implemented a workaround which suspends both ConnectionHolder (if present) and SessionHolder in doSuspend method and later resumes these resources in doResume method.
I wonder if this is a bug in TopLinkTransactionManager or an intended behaviour (maybe i miss some details of transaction synhronization for TopLink)?
Tags for this Thread