posted 18 years ago
Just to add, for more clearification. BMT vs CMT. It's just way
of classifying beans basesd on how they manage there transactiions.
For BMT, you are to the container that that YOU, the bean provider
is going to manage the bean transaction (tx) yourself. And For CMT, you get
telling the Container, Hey, please manage my bean transction for me, and
the Container reply HOW. You just say check my bean DD for instructions on how.
To add more, for BMT, you just have to use the javax.transaction.UserTransaction interface, while for CMT, you have
to use the setRollbackOnly() and getRollbackOnly() from EJBContext. eg
BMT
UserTransaction ut = EJBContext.getUserTransaction(); // get the tx
ut.begin() // start the tx
foo();
bar();
if(allIsFine){
ut.commit(); // commit tx
} else {
ut.rollback(); // rollback tx
}
CMT
It's more of declarative, it has only two methods that
you can use to manage your tx and they are handled on methods bases.
if (allAnyBad) {
EJBContext.setRollbackOnly(); // tx will never commit.
}
To check for tx status,
BMT
ut.getStatus();
CMT
EJBContext.getRollbackOnly();
Hope the difference is clear.
SCJA(Beta) SCJP 1.4 SCWCD 1.4 SCBCD 1.3 SCBCD 5.0 beta <br />The more practice we get, the better we are at the exams and in life in general. Pls join me at My DEN.