In a Web app of mine that uses Spring's
a) org.springframework.transaction.jta.JtaTransaction Manager as Spring TX Manager
over an external JTA implementation and
b) org.springframework.orm.jpa.LocalContainerEntityMa nagerFactoryBean as EMF
I a noticed the following behavior:
When I try to control transaction boundaries via a servlet filter that uses the UserTransaction object, Spring's EM seems to be not registered with the TX. I.e. persistent object get detached right away.
When I use @Transactional however, everything works as expected. When digging for a root cause of this I noticed that TransactionSynchronizationManager is the class managing resource binding to the tx and require Spring proprietary initialization.
Is it true then that the observed behavior can be expected? And is there a way to bridge these two TX implementations, so that it is possible to control transaction demarcation outside of spring and still have everything work?