• 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

Transactions

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a scenario where I have two business entities. Say B1 and B2. I have writen Stateless session beans for B1 and B2. I have B1DB, B2DB which my session beans would talk to, inorder to make any database queries. I haven't decided if I have go with entity beans for B1DB and B2DB.

Now, on few scenarios when I update B1 data, I have to update B2 data. To acheive this,

1. I can call B2 update method from B1 update method. In this case how can I control transaction. I mean if B2 update is unsuccessfull, I have to roll back B1 update and vice versa. If I specify trasaction=true for business beans in the deployment descriptor would take care this situation?

2. Write a stored procedure that would update both the tables and commit whole transaction on sucess else roll back.
Is this the correct approach?.

Please suggest me.
Saritha
 
Saritha Penumudi
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please suggest me on this.
 
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi saritha,
You can call B2 update method from B1 and can specify that both the updates should be in same transaction. Which app server you are using. You need to specify the transaction attributes.

Regards,
Sawan
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If your Session Bean B1 & B2 are having somw comman functionality .......

then what about if you extend B2 with B1.........
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic