my dog learned polymorphism*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes MDB and transactions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "MDB and transactions" Watch "MDB and transactions" New topic
Author

MDB and transactions

kenny lomax
Greenhorn

Joined: Mar 08, 2006
Posts: 9
Hello
I have a query about MDB Transaction in Headfirst EJB:

p. 508
MDB must complete a txn before the end of OnMessage()
p.516 (Q3c)
The container does not throw an error if onMessage returns before a txn is committed (or I assume rolledback)

So who exactly does insist that the OnMessage transaction must be completed in the method?
Many thanks!
Kenny
Muthaiah Ramanathan
Ranch Hand

Joined: May 16, 2005
Posts: 102
For the CMT, the transaction is linked with the message acknowledgement and therefore the container insists the transaction better be completed and otherwise it will have to rollback.


SCJP 1.6, SCJD, SCWCD, SCBCD.

Be nice to people on the way up cos, you'll need 'em on your way down - From somewhere I can't remember!
kenny lomax
Greenhorn

Joined: Mar 08, 2006
Posts: 9
Hi
thanks for that clarfication, but I am still unclear:
EJB law says the transaction must be completed (committed or rolledback) before OnMessage completes.
If we are using BMP, and have a
tx.begin
but no tx.rollback in the OnMessage method, who complains?

Is it the deployment, the container, no one?
Thanks
Kenny
Muthaiah Ramanathan
Ranch Hand

Joined: May 16, 2005
Posts: 102
Kenny,

Hello
I have a query about MDB Transaction in Headfirst EJB:

p. 508
MDB must complete a txn before the end of OnMessage()
p.516 (Q3c)
The container does not throw an error if onMessage returns before a txn is committed (or I assume rolledback)

So who exactly does insist that the OnMessage transaction must be completed in the method?


Here p. 508: MDB must complete a txn before the end of OnMessage() refers to BMT. The spec says only stateful session bean is allowed to keep a transaction open - No one else has that previllege. It is insisted by the EJB2.0 spec and therefore the container doesn't allow it.


p.516 (Q3c): The container does not throw an error if onMessage returns before a txn is committed (or I assume rolledback) refers to CMT. The MDB will just rollback in this case - it will NOT throw any exception.
[ March 12, 2006: Message edited by: Muthaiah Ram ]
Kenny Lomax
Greenhorn

Joined: Mar 08, 2006
Posts: 6
Many thanks - all clear now
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MDB and transactions
 
Similar Threads
MDB with MessageConsumers
question about MDB and JMS
doubt about when an MDB redelivered happen's and not?
A question about MDB
Question on MDB