Hi,
Is it correct to say that using JTA
Transactions with Hibernate
contrasts using the Open-Session-In-View
with regards to the session scope?
From what I've been able to gather the Session scope in the JTA
Transactions is a transaction (mainly based on this link) while in the Open-Session-In-View
pattern the session's scope is the requrest and you can have multiple transactions in it.
I'm asking, first to understand, and secondly to verify "Who" is responsible for the session handling when using JTA
.
Currently, when using the Open-Session-In-View
, I have a HibernateUtil
class which handles opening, retrieving and closing of sessions (via ThreadLocal<Session>
).
When I'll switch over to using JTA
will Hibernate
handle the above session actions? (as a derivative maybe of my calling userTransaction.begin,userTransaction.rollback)
BTW, I'm asking about JTA
as I need to coordinate a transaction across Hibernate
JMS
and EHCache
so this isn't a general best-practices "lets-use-JTA" question.
Ittai