Hi,
I have en EJB that call another EJB that opens a session using ThreadLocal pattern and after do some work getting other session. That looks like this:
Code:
public void methodA(Object obj)
{
methodB(obj.getChild()); // in another EJB
session = ThreadLocalSession.currentSession();
delete(obj)
session.flush();
ThreadLocalSession.closeSession();
}
public void methodB(Object obj)
{
session = ThreadLocalSession.currentSession();
delete(obj)
session.flush();
ThreadLocalSession.closeSession();
}
I'm closing the Session in the methodB but I want that both delete operations be part of the same transaction. I'm using JTA transaction with CMT. The question is :
The Session.close() commits the transaction ? Or the container do this ?