Hi,
Let me elaborate...
The Session bean has 3 methods method a(), b(), and c(). To group all these three methods in a usecase, you should also have a seperate method, say x() in the same Session bean (or you can have it in other Session bean also, in that case methods a, b, and c will be called from that bean. For simplicity let it be in the same bean itself, for our discussion)
Transaction attributes:
method x() - Required
method a() - Required
method b() - RequiresNew
method c() - Required.
With this setup, if you invoke method x() on the session bean, a new Transaction(say T1) is started. now method a() will use the same tranaction (T1). For method b() a new Transaction (T2) will be created and T1 will be suspended. When method b() completes, the container commits or rollback the transaction T2, and T1 resumes. So now method c() uses T1 for it's processing.
Be sure to handle the exceptions correctly...
method x()
{
try {
a(); // uses Tx T1...
b(); // creates new Tx T2...
c(); // uses Tx T1...
}
catch(Exception e)
{
// notify the container to rollback the Tx
getSessionContext().setRollbackOnly();
}
}
follow the same way for every method...
Hope this helps...
Thanks,
Malar.