This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Urgent transaction question!

Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my project, i have a sessionbeanA, it has methodA(). In methodA(), i call classB's methodB(). In methodB(), I first call classC's methodC() and then classD's methodD(). In methodC() will call entitybeanE's methodE(); in methodD() will call entitybeanF's methodF(). methodE() will insert record to table1, and methodF() will insert record to table2.
What i want: when exception happen in classD's methodD(), inserted record in table1 will rollback.
What i do:
1. Transaction is container managed transaction.
2. Set transaction attribute for sessinbeanA,entitybeanE,entitybeanF as 'Required'.
3. Exception in methodD(), will be finally caught in sessionbeanA's methodA(). code in methodA() is as following:
bla bla
catch(AppException ex)
What i get: inserted record in table1 is still there, not rollback.
What's wrong?? Any correction is highly appreciated.
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you please make it clear. give more info. code will help ....
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!