ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sudhir, Sudhir (Contractor)" <SSud...@moneygram.com>
Subject RE: Nested transactions?
Date Wed, 30 May 2007 23:02:39 GMT
Thanks,

The only issue that you run into quite often is that you need both
composite services as well as more fine grained services and both these
kinds of services need to be "transaction aware". So you end of creating
"layers on top of the service layer" to delegate and allow for
transactions. Not a problem other than the fact not you have  a set of
methods that do nothing but start and end transactions, just becomes
cumbersome I guess.

So essentially if I wanted to do something to the effect, is my only
option to re-factor such behavior into a different method?:

> ServiceClass1

> public void doSomething() {

>       try {

>              daoManager.startTransaction();

>              // Write some stuff to a database

>              daoManager.commitTransaction();

>       } catch (Exception e) {

>              throw e;

>       } finally {

>              daoManager.endTransaction();

>       }

> }

> 

> ServiceClass2

> public void doSomethingElse() {

>       try {

>              daoManager.startTransaction();

>              ServiceClass1 sc1 = new ServiceClass1();

>              sc1.doSomething();

>              // Write some stuff to a database

>              daoManager.commitTransaction();

>       } catch (Exception e) {

>              throw e;

>       } finally {

>              daoManager.endTransaction();

>       }

> }

Thanks,

-Sudhir

 

From: Clinton Begin [mailto:clinton.begin@gmail.com] 
Sent: Wednesday, May 30, 2007 5:47 PM
To: user-java@ibatis.apache.org
Subject: Re: Nested transactions?

 

Nested transactions are evil*.  iBATIS has a strict policy to use its
powers only for good.  So unfortunately no.  

:-)

Clinton

* Why? See the 'A' in ACID.  http://en.wikipedia.org/wiki/ACID  

On 5/30/07, Sudhir, Sudhir (Contractor) <SSudhir@moneygram.com> wrote: 

Does iBatis support nested transactions?

-Sudhir
----------------------------------------- 

This message may contain confidential information.  If you are not
the intended recipient, please notify the sender immediately and
delete this email from your system.

 


Mime
View raw message