ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rashmi Dave <rash...@persistent.co.in>
Subject Re: Nested Transactions
Date Tue, 14 Mar 2006 17:29:43 GMT
Hi Jeff,

This code isnt in the DAO at all. It is present in my 
business layer. What I want to know is that is there anything 
like a nested transaction? If I call start transaction twice 
one after the other, is the second call valid? Or will the 
first commit transaction commit all the statements called 
earlier?

Thanks. Sorry if I wasnt very clear in the previous mail.

Regards
Rashmi

---- Original message ----
>Date: Tue, 14 Mar 2006 10:42:05 -0600
>From: "Jeff Butler" <jeffgbutler@gmail.com>  
>Subject: Re: Nested Transactions  
>To: user-java@ibatis.apache.org
>
>   Why not do this in one transaction?
>    
>   The ABC DAO class should not have any transaction
>   code in it, either should the XYZ DAO.  A service
>   level method should do the transaction code:
>    
>   CreateABC -
>   Insert ABC
>    
>   Create XYZ -
>   Insert X
>   Insert Y
>   CreateABC
>   Insert Z
>    
>   XYZ Service -
>   Start T1
>   Create XYZ
>   Commit T1
>    
>   Jeff Butler
>
>    
>   On 3/14/06, Rashmi Dave <rashmid@persistent.co.in>
>   wrote:
>
>     Hi All,
>
>     I am not sure if this is a silly/obvious question,
>     however, here goes:
>
>     I have a function called CreateABC. This starts a
>     transaction, inserts into
>     the DB and then commits the transaction and
>     finally stops it.
>
>     I have another function which is called CreateXYZ.
>     This function also does
>     the same thing. However, it also calls CreateABC
>     internally since ABC needs
>     to be created as part of creation of XYZ.
>
>     CreateABC -
>     Start T1
>     Insert ABC
>     Commit T1
>
>     CreateXYZ -
>     Start T2
>     Insert X
>     Insert Y
>     CreateABC
>     Insert Z
>     Commit T2
>
>     What I want to know is, in case Insert Z fails,
>     and a rollback needs to be
>     done, will ABC, X and Y get rolled back? I am
>     using Abator generated classes
>     for ibatis...
>
>     TIA
>
>     ~Rashmi
Rashmi Dave
Senior Member of Technical Staff
Persistent Systems Pvt Ltd


Mime
View raw message