Hi, I think you need to understand first few thigns on EJB transaction.
1. Read about ACID : Basic properties of transactions can be summarized using the ACID mnemonic:
2. Transaction Attributes
Transactions can be defined at several different levels and in several different ways.
- Levels
3. Isolation Levels : Isolation levels provide a degree of control of the effects one transaction can have on another.
Then how to
Implementing Two-Phase Commits...
I asume you are using some Application server before telling all the above..
any way if you uise any vendor Application server like IBM WSAD, BEA Weblogic.
Life makes simple...for your problem...
Here goes...how
In the Session EJB method, enclose the statement(s) that start the
thread that eventually reaches the operations on multiple EJBs within a try-catch block; e.g.,
try {
return domain.updateBoth( DataBean dataBean);
} catch ( Exception e ) {
mySessionCtx.setRollbackOnly();
}
Note: mySessionCtx is a global variable that is generated by WSAD and included in the Session EJB.
I hope this helps you..
Viswa