thanks john, Your example was too simple in my case as this is stuff i used to do when i ams stuck with such cases. Guess all(ok, not all ;-) of us think alike more or less :-)
But now it was something different so couldn't rely on this way. Thanks for the links. -navjot |-----Original Message----- |From: Johan [mailto:[EMAIL PROTECTED] |Sent: Thursday, June 12, 2003 11:53 PM |To: Struts Users Mailing List |Subject: Re: [OT] Transaction Safe Java Code | | |Just found something of interest |http://www.objectweb.org/jotm |http://www.objectweb.org/jotm/current/jotm/doc/howto-tomcat-jotm.html | |A opensource transactionmanager which you can use to solve your problem. | |Johan | |Johan wrote: |> Maybe to simple :-) |> consider the following snippet |> |> int x = 0; |> try { |> x=x+10; |> x=x+10; |> somethingMightThrowingAnException(x); |> x=x+10; |> } catch (Exception e) { |> } |> |> if somethingMightThrowingAnException(x) is not throwing an exception x |> would be 30 in the end. but if somethingMightThrowingAnException(x) is |> throwing an exception the value of x=20. For the transaction it should |> be 0. |> |> I think you need a transactionmanager to solve this problem. |> |> Johan |> |> Erik Price wrote: |> |>> |>> |>> Navjot Singh wrote: |>> |>>> Hi List, |>>> |>>> I have 2 methods that i am calling in same sequence. |>>> |>>> + txnMethod1() |>>> + txnMethod2() |>>> |>>> I wish either both of them get _executed_ or none of them. |>>> |>>> Can i rollback the state to what was before method1's _execution_ if |>>> method2 fails? |>>> |>>> Is it possible or i should start thinking simple? |>> |>> |>> |>> Think simple: throw an exception. |>> |>> |>> |>> Erik |>> |>> |>> --------------------------------------------------------------------- |>> To unsubscribe, e-mail: [EMAIL PROTECTED] |>> For additional commands, e-mail: [EMAIL PROTECTED] |>> |>> |> |> | | |-- |Nilling Software Design |Postbus 43 |2280 AA Rijswijk ZH |w: http://www.nilling.nl | | |--------------------------------------------------------------------- |To unsubscribe, e-mail: [EMAIL PROTECTED] |For additional commands, e-mail: [EMAIL PROTECTED] | | --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

