Posted by danielmeyer on December 16, 2008
A kind soul answered my second post to the Spring Data Access forum in which I had asked, “Does JtaTransactionManager support beforeCompletion synchronization?“
He said, “Look at: SessionFactoryUtils#getJtaSynchronizedSession”.
The getJtaSynchronizedSession() method didn’t appear in org.springframework.orm.hibernate3.SessionFactoryUtils’ javadoc, so I pulled up the Spring source code I had checked out earlier and there it is (it’s a private method).
I right-clicked the method name in the editor and selected Open Call Hierarchy (have I mentioned that I’m loving the tool support these days?!) The only three places it’s called from (another layer or two down) are the two getSession() methods and the one public doGetSession() method…
When I had initially pulled up SessionFactoryUtils’ javadoc this had immediately jumped out at me:
Note that for non-Spring JTA transactions, a JTA TransactionManagerLookup has to be specified in the Hibernate configuration.
Aha: We’re not specifying a JTA TransactionManagerLookup in our Hibernate configuration. Looks like that would be the next thing to look at.