ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Apesa" <vap...@hotmail.com>
Subject Re: Transaction question
Date Fri, 11 May 2007 23:13:49 GMT
In my group we choose not to use Ibatis transactions or Sessions at all. Our 
transactions are called in the Business Logic/ Service Layer.

We use System.Transactions in .net 2.0. This rolls back other types of 
things like Mail etc.


----- Original Message ----- 
From: "Mike Hill" <hillmb@insightbb.com>
To: <user-cs@ibatis.apache.org>
Sent: Friday, May 11, 2007 11:48 AM
Subject: Transaction question

> Hello,
> I'm new to iBatis .NET and had a quick question about how the 
> session/transaction stuff should work.  The documentation examples shows 
> something like this:
> try
> {
>    sqlMap.BeginTransaction();
>    Item item = (Item) sqlMap.QueryForObject("getItem", itemId);
>    item.Description = newDescription;
>    sqlMap.Update("updateItem", item);
>    sqlMap.CommitTransaction();
> }
> catch {
>    sqlMap.RollBackTransaction();
> }
> Which works fine in this simple case where all of the transaction logic 
> exists in the data layer.  In my case, I have several different Data 
> Access Objects I've created (roughly one for each of my entity objects), 
> and from my business logic layer I want to call several methods across the 
> different DAOs and have them all participate in a transaction.  Can 
> someone guide me in the right direction?
> All the DAO classes extend from a common base DAO which can easily 
> begin/rollback/commit a transaction by getting an instance of the 
> ISqlMapper and calling the appropriate methods.  However since the mapper 
> is a singleton, and a transaction has been started, wouldn't this then 
> cause other DAO methods which may be called to inadvertently participate 
> in the transaction since each DAO would be using the same ISqlMapper 
> instance?
> Thanks,
> Mike

View raw message