Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

MDB does not rollback  RSS feed

 
manish gupta
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am MDB with container transaction, my MDB invoke when any message come in queue ,I process the message and insert the record in DB after inserting in DB I call another method to get some other detail from DB,this is throwing exception .
all transaction happening in onMessage();
I want if any exception occurs then it should roll back and there should not be any record in DB.

But it is not happening like that it is not removing inserted record from DB.

pl solve my problem

Thanks
Manish
 
Alejandro Dominguez
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Manish,
can you post your code?

I tried out something simple:



and the ship is not getting persisted, so the transaction is actually being rolled back; are you catching the exception? Is it a RuntimeExcpetion?

Alejandro
 
Sunil Dixit
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Manish,
On the top of words said by 'Alejandro' I would like say you please check Tx attribute,if you are calling another EJB component.
Make it sure that all other component doesn't have Require-New attribute. If that is the case than this situation can come.

Cheers,
Sunil Dixit
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!