• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MDB does not rollback

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Hey! You're stepping on my hand! Help me tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic