Hello All,
Im a bit confused about the relationship between JTA and CMT ( container-managed txs), and how Hibernate synchronizes with them.
Most docs/forums out there use JTA to imply a user-controlled transaction, via the UserTransaction interface. Hibernate is provided the JNDI lookup name for the UserTransaction object, and it uses it to synch up its own transactions with the UT. That seems pretty clear.
What's not clear is how Hibernate synchs up with CMT? My understanding is that container-managed transactions still use the JTA API, but just not the UserTransaction interface. The provided TransactionManagerLookup class is used to lookup the container's TransactionManager, and then Hibernate can get a handle on the CMT by calling TransactionManager.getTransaction, and synch up with it. Is this correct?
If so, why does the Hibernate code inside the Transaction.begin method require that a UserTransaction class be present via JNDI when using JTATransaction? If Hibernate is used within a CMT, then the presence of a UserTransaction should be irrelevant. It should only ask the TransactionManager for the current transaction ( which would return the CMT ) and go from there. Is this the way it should work? If not, how does Hibernate synchy up with container-managed transactions?
Thanks,
-Ogi.