• 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

transaction management

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are various way to manage transactions in J2EE application.

I have two methods in my simple DAO in both i am getting connection from the application connection pool,one method which updates the DB1 and other updates DB2.(I want to manage them as one single transaction.


this is the flow
Client meth1() -calls--> stateless session bean meth1()- calls---->which meth1() and meth2() of DAO.

my questions:

Can i maintain transcation at sateless session bean meth1()?
If yes I am afraid that in my DAO i am gettting fifferent connects inmeth1() and meth2().Will rollback on session bean rollback both meth1 and meth2 of DAO?
 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use XA transactions. (Which will be implicit as long as you do this)

Use CMT (You can use BMT as well.. but its safer to do CMT)
Specify the transaction attribute as "Required"
Make sure your app server supports XA transactions

Client meth1() -calls-->
stateless session bean meth1()- calls---->
DAO.meth1() // works with datasource 1
DAO.meth2() // works with datasource 2

Voila...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic