Announcement Announcement Module
No announcement yet.
SpringSessionSynchronization with JtaTransactionManager Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • SpringSessionSynchronization with JtaTransactionManager

    I'm trying to register the SessionFactoryUtil.SpringSessionSynchronization with the JtaTransactionManager I have configured as:

    	<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
    		<property name="userTransactionName">
    This is because I need full JTA transaction but Hibernate is part of these transactions and I have a problem where the Hibernate Session isn't being flushed before commit.

    Does anyone know how to register the above SpringSessionSynchronization with the JtaTransactionManager in the configuration?

  • #2
    It appears that this has to be done programmatically so I elected to modify some of my code to use the SessionFactoryUtils.getSession() method which will handle registering the correct TransactionSynchronization upon creation of a new Session. I wanted some of the other intelligence built into the SessionFactoryUtils class, otherwise I believe could have also extended the JtaTransactionManager to register the SpringSessionSynchronization upon instantiation.