Our Craft

Making it better

An answer

Posted by danielmeyer on December 16, 2008

This post is part 7 in a 9-part series on Envers, Spring, and JTA. The next post is The final answer, and the previous post is beforeCompletion, I need to figure this out.


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.

Update: Here’s help for someone who had a similar issue.  Also, the Using JTA section of the Hibernate Reference Guide…

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.