Hi,
I have a peculiar problem. I have 3 Stateless Session Beans. All of these beans have Bean Managed Transaction.
Let us say BeanA, BeanB and BeanC are the 3 beans. There are 3 methods inside each Bean, ie Method1(), Method2() and Method3() inside BeanA, BeanB and BeanC respectively. Method2() and Method3() have to be invoked from Method 1(). Consider the following stub of BeanA
BeanA:
public void Method1()
{
UserTransaction ut;
//Do some Initialisation
...
...
try
{
ut.begin();
//Do Some
JDBC Operations
......
BeanB.Method2(); //Invoking Method2 of
EJB Bean2.
BeanC.Method3(); //Invoke the method3 of Bean3.
//Do Some more JDBC Operations
......
ut.commit();
}catch (Exception e)
{
ut.rollback();
}
}
The problem is this, the status of the UserTransaction inside BeanA.Method1() is "0"(Zero), which corresponds to "ACTIVE". However the status of the UserTransaction inside BeanB.Method2() and BeanC.Method3() is 6, which corresponds to "NO_TRANSACTION".
The consequence of this is, if there is any exception, the changes made by BeanA are rolled back, but not the changes made by BeanB or by BeanC.
There is no commit or rollback or beginning of a new transaction or ending of any transaction inside BeanB or BeanC.
So my question is this, why is the transaction not getting propagated across Beans? And what can I do, to get the transaction propagated across Bean boundaries?