Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MDB and transactions

 
kenny lomax
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
kenny lomax
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks - all clear now
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic