In 2nd Q --which tx attibute must not be used for MDB?? The ans -- ReqNew,Mand,Never,Supports I don't understnd how is that??
Mand & Never throws exception ok fine... Then what about supports & Reqnew?? I thought for MDB there should not be any previous tx context ..so, Supports must not be used .ok fine again then why ReqNew?? & why not Required??
can anyone understand my point?? if yes, pls reply & clarify where I'm wrong
Required means that the bean is running in the tx from the incomming request, or in a new one if there is no incomming tx. But for MDB there is no incomming request, since there is no client! So RequiresNew is a "cleaner" definition in a way...
But I agree it is a bit tricky, I have also wondered why only RequiresNew and not Required...
Miki<br /> <br />SCJP 1.4, SCBCD 1.3
Joined: Jul 14, 2004
I guess ReqNew can be used rather than Required... b'coz its not required to run in the previous tx for MDB. Can anyone clarify?? I'm confused!!!
Hi, There is nothing written in specs that why RequiresNew can't be used but I think the possible reason is that in case of MDB with CMT the message receipt is included as a part of the bean's transaction . That means (message receipt + onMessage()) makes on transaction. If the specs would have allowed RequiresNew then you can see the problem with the message receipt.
This is what I think and I haven't read it anywhere .
Thank you all for all ur replies!! I guess I have to remember MDB must use only Required & Not Supported Required & Not Supported Required & Not Supported Required & Not Supported Required & Not Supported
Hey it easy to figure out why if you know that a MDB is never called in Tx of a client. So then the logic is:
ReqNew - does not make sense since the is no "old" transaction
Mand - if you specify this the method will alway throw an exception of course this can never be what you want
Never - This is allways the case so why should you specify it again? you specify Never to throw an exception when a method is called in Tx context, bit this nver happens with a MDB so why specify Never