posted 16 years ago
If the bean has container managed transaction (CMT) demarcation, then the bean methods' transactions are managed by the container. you have to define the desired tx attribute in the deployment descriptor of the bean.
- Now if the container is managing tx for the bean, what if something goes wrong in the bean and if the bean does not want the container to commit the tx? in such a case, bean can use context.setRollBackOnly() method to indicate that the tx should /would not be commited. This is how the bean forces the tx to roll back
-Suppose a bean method m1 calls another method m2 on second bean having tx atribute Required, then the m1's tx xontext is passed to m2. suppos m2 wants to check if the tx has already bean set to roll back by m1, then it can use use context.getRollBackOnly()
Hope this makes clear.
[ March 10, 2004: Message edited by: Rashmi Tambe ]