Return-Path: Delivered-To: apmail-incubator-ibatis-user-java-archive@www.apache.org Received: (qmail 12947 invoked from network); 5 May 2005 21:44:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 May 2005 21:44:30 -0000 Received: (qmail 54097 invoked by uid 500); 5 May 2005 21:46:50 -0000 Delivered-To: apmail-incubator-ibatis-user-java-archive@incubator.apache.org Received: (qmail 54055 invoked by uid 500); 5 May 2005 21:46:50 -0000 Mailing-List: contact ibatis-user-java-help@incubator.apache.org; run by ezmlm Precedence: bulk Reply-To: ibatis-user-java@incubator.apache.org List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list ibatis-user-java@incubator.apache.org Received: (qmail 54003 invoked by uid 99); 5 May 2005 21:46:49 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of gthought@gmail.com designates 64.233.184.194 as permitted sender) Received: from wproxy.gmail.com (HELO wproxy.gmail.com) (64.233.184.194) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 05 May 2005 14:46:49 -0700 Received: by wproxy.gmail.com with SMTP id 69so732427wri for ; Thu, 05 May 2005 14:44:18 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=jSrbe3dYOiq5KeX1iSwYirmzeN+waGmaXGXoe8SOH3fbqMk2aU0xqSLDobKBlgSW11aPKFlm/8S/rsbWYeR3SjA+RqVv4PdAuYygJUGkveKK8YUgO/8BFjzOQT2ODyAzAgRrBHfkJhHnl5ejizOuOr88v0SE6SdCu5oSnHQCGtk= Received: by 10.54.156.15 with SMTP id d15mr394609wre; Thu, 05 May 2005 14:44:18 -0700 (PDT) Received: by 10.54.80.14 with HTTP; Thu, 5 May 2005 14:44:18 -0700 (PDT) Message-ID: Date: Thu, 5 May 2005 16:44:18 -0500 From: Gregg D Bolinger Reply-To: Gregg D Bolinger To: ibatis-user-java@incubator.apache.org, paul.barry@nyu.edu Subject: Re: DAO and Batch in Single Transaction In-Reply-To: <427A8A9F.7070500@nyu.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <16178eb105050408292ab8be01@mail.gmail.com> <16178eb105050414435ba2d552@mail.gmail.com> <16178eb105050414465a06b12f@mail.gmail.com> <427A8A9F.7070500@nyu.edu> X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N yes, and it's basically the same problem. I have no problems with transactions. It's batching that I am dealing with. 2 different animals. :) On 5/5/05, Paul Barry wrote: > Have you looked into Spring's transaction management? >=20 > Gregg D Bolinger wrote: > > I actually talked about this approach with a colleague just last > > night. We are using a singleton for our daoManager so this would work > > perfectly, I think. I'll try it out and let you know. > > > > On 5/4/05, Clinton Begin wrote: > > > >>Oops....forgot to mention another pattern... > >> > >> One thing you can do is have a BatchDAO which basically just defines t= wo > >>methods: startBatch and endBatch. Then you could do: > >> > >> daoManager.startTransaction() > >> batchDao.startBatch() > >> someDao.insert() > >> someOtherDao.update() > >> anotherDao.delete() > >> batchDao.endBatch() > >> daoManager.commitTransaction() > >> > >> That would give you the flexibility of batching in some cases, but not= all. > >> You could even delegate the call to daoManager.startTransaction() and > >>batchDao.startBatch() to a base service method, so you wouldn't always = have > >>to call both. I typically put such methods in around advice or just a > >>simple dynamic proxy at my service layer. > >> > >> Cheers, > >> Clinton > >> > >> > >>On 5/4/05, Clinton Begin wrote: > >> > >>>That is actually an option. I thought about adding that in 2.0, and I= IRC > >> > >>it wouldn't be hard to add. > >> > >>>Of course, you'd have to live with the challenges of what basically > >> > >>amounts to a write cache. That is, in this scenario: > >> > >>>start TX > >>>insert into PEOPLE > >>>select from PEOPLE > >>>end TX > >>>select from PEOPLE > >>> > >>>...the result of the first insert would not be seen by the first selec= t, > >> > >>but would be seen by the second. > >> > >>>Cheers, > >>>Clinton > >>> > >>> > >>> > >>>On 5/4/05, Gregg D Bolinger < gthought@gmail.com> wrote: > >>> > >>>>Well, my approach won't work. You can't get to the startBatch from > >>>>the service. DaoManager only handles transactions. SqlMpa handles > >>>>batching. So the batches have to be done in the DAO which makes it > >>>>impossible to batch more than one DAO. > >>>> > >>>>What would be nice is if iBatis just batched transactions by default. > >>>> > >>>>On 5/4/05, Clinton Begin < clinton.begin@gmail.com> wrote: > >>>> > >>>>> Your approach sounds good. I wouldn't try to overcomplicate this. > >>>>> > >>>>> Cheers, > >>>>> Clinton > >>>>> > >>>>> > >>>>>On 5/2/05, Gregg D Bolinger wrote: > >>>>> > >>>>>>I am using iBatis SqlMap and iBatis DAO. I am trying to look into > >>>>>>doing batch inserts/updates/delete within a single transaction for > >>>>>>multiple DAO's. So should I create a Service that just handles my > >>>>>>batches and has an instance of each DAO that it needs, or is there = a > >>>>>>different way? Anyone have any tips or hints on doing this? > >>>>>> > >>>>>>Thanks. > >>>>>> > >>>>> > >>>>> > >>>> > >>> > >> >