1 posts in topic
Flat View  Flat View

Posted By:   Abhay_Shukla
Posted On:   Saturday, May 4, 2002 11:12 AM

I have three classes A, B and C in packages a, b and c respectively.In the method C of class C, I call methods
of class A and class B.

Both methodA and methodB obtains its connection from the pool.
However, during the execution of methodC, I want to make sure that updates made in methodA are committed only if updates in methodB succeeds.

Since I do not have the connection object in methodC, or for that matter,
in the class C, how do I rollback or commit the updates taking place in different methods of different classes?

Re: Transactions

Posted By:   Bozidar_Dangubic  
Posted On:   Sunday, May 5, 2002 07:22 AM

these are just regular java classes executing in some JVM? if so, the only way to do it would be to create a connection in class C and pass it around in each method invocation. if you are in application server and these classes are EJBs, then it is a completely different story. but if we are talking about plain java classes, you have to pass the connection around. even then you have to be clever since you are executing multiple statements so you will probably have to use batch functionality to get everything working.
About | Sitemap | Contact