This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes pg. 497 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "pg. 497" Watch "pg. 497" New topic

pg. 497

Deepa Korecherla
Ranch Hand

Joined: Jul 14, 2004
Posts: 197
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, 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

Miki Muzsi
Ranch Hand

Joined: Jun 23, 2003
Posts: 120
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
Deepa Korecherla
Ranch Hand

Joined: Jul 14, 2004
Posts: 197
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!!!
sawan parihar
Ranch Hand

Joined: Aug 24, 2004
Posts: 250
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 .


Sawan<br />SCJP,SCWCD,SCBCD<br /> <br />Every exit is an entry somewhere.
Meg Adal
Ranch Hand

Joined: Mar 12, 2002
Posts: 70
Deepa Korecherla
Ranch Hand

Joined: Jul 14, 2004
Posts: 197
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
Amos Coats

Joined: Oct 11, 2004
Posts: 9
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

Supports - There is no client Tx to Support!!!

I agree. Here's the link:
subject: pg. 497
jQuery in Action, 3rd edition