Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Call 2 Trx's with RollBack Option for 1st call.

 
Dhir Virat
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How should we combine two transactions into 1 call and yet make the Transaction Rollback savvy. Let me represent with a scenrio logically
MySessionBean
{
methodA() - trx attribute ( REQUIRED / NEW )
methodB() - trx attribute ( NEW )
}
Here is what the intention is:
If MethodA Fails - RollBack
If MethodA Success - method B Fails - RollBack Trx for A two.

There is reason for not a combining the calls to method B and method A. Otherwise teh Roolback Issue would have been simpler.
Any Reference - material where the detailed explaintion of such/similar cases will high be appretiated.
 
Roland Barcia
author
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is method A and B regular Java calls or other EJB's?
 
Dhir Virat
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These will be just java calls within the sessionBean MethodX(){ callA, callB}
 
Frederico Melo
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Dhir..
I think it's a nice scenarium for a client-initiated transaction, wich would propagate for the two session beans' methods.
regards,
Fred
 
Kalyan Mudumbai
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't you use a SessionFacade to combine the two transactions into one single transaction? Something like:
class SessionFacade
{
methodX()
{
if(!methodA())
{
rollbackA();
}

if(!methodB())
{
rollbackA();
rollbackB();
}
}
}
I'm not sure if I really understood your problem. Just a suggestion.
Thanks,
Kalyan.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!