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!
Joined: Mar 08, 2006
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
Joined: May 16, 2005
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 ]