Originally posted by Anand
I am too confused abt what methods run in
Callers Transaction context
Unspecified transaction context
and no transaction context
Hi Anand,
Let's break your question down, to get a clear picture of the situation.
First a transaction is
unit of say work, either all successed or all fails. The same is true, if any of the work fails. There isn't 30%,80% or 99%, like
we do get from all this exams. It is either you get 100% 0r you go back and pay more bucks to those guys at Sun. So hope you got that.There is <tran-attribute> used to specify transaction type in the DD (only for CMT).
Unspecified transaction context: This is a bit complex, even the spec say so, it simply mean the container can handle the transaction, in an undefined
manner. To you, it's like i don't know, but the container can choose to
handle it whichever it chooses. Ok let's hit some examples.
Let's use three methods, say A,B,C.
For BMT.
methodA() { // this is the caller method.
tx = context.getUserTransaction();
tx.begin(); // transaction starts
methodB(); // Called method it's part of the transaction
tx.commit(); // transaction commit ie end
methodC(); // methodC is called without transaction context
// not part of the transaction
For CMT, it's on method bases depending on the attriute in the DD.
Wao, hope it's help