Return-Path: Delivered-To: apmail-ibatis-user-cs-archive@www.apache.org Received: (qmail 86280 invoked from network); 4 Jan 2006 18:19:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Jan 2006 18:19:01 -0000 Received: (qmail 42503 invoked by uid 500); 4 Jan 2006 18:18:50 -0000 Delivered-To: apmail-ibatis-user-cs-archive@ibatis.apache.org Received: (qmail 42431 invoked by uid 500); 4 Jan 2006 18:18:50 -0000 Mailing-List: contact user-cs-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-cs@ibatis.apache.org Delivered-To: mailing list user-cs@ibatis.apache.org Received: (qmail 42341 invoked by uid 99); 4 Jan 2006 18:18:49 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of ibatis.net@gmail.com designates 64.233.182.195 as permitted sender) Received: from [64.233.182.195] (HELO nproxy.gmail.com) (64.233.182.195) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jan 2006 10:18:46 -0800 Received: by nproxy.gmail.com with SMTP id l35so1015692nfa for ; Wed, 04 Jan 2006 10:17:25 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=MO4NuqVNIP3cn4OSJ9eJjWGmMcFBQITbpvhuluT9As5MLa9w6L18ocdeDr+OEJ68k2fYaYR2AuRrt37OrhUwuoqt1ma/IORP5/+ifLHttkCadBo0hrgODQCr+M4eTRir6d/bptTCV65V4zwic8AEZgwLJt6UOMU3MnexbBVGfD0= Received: by 10.48.142.8 with SMTP id p8mr640246nfd; Wed, 04 Jan 2006 10:17:24 -0800 (PST) Received: by 10.48.42.14 with HTTP; Wed, 4 Jan 2006 10:17:24 -0800 (PST) Message-ID: Date: Wed, 4 Jan 2006 19:17:24 +0100 From: Gilles Bayon To: user-cs@ibatis.apache.org Subject: Re: Nested / Multiple Transactions open on same thread? In-Reply-To: <5f9068320601040939u1e74a7f5pb6bb6be6e72077e9@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4015_14056900.1136398644945" References: <5f9068320601040911t7e322023ydb4fa8073f1bc09c@mail.gmail.com> <5f9068320601040939u1e74a7f5pb6bb6be6e72077e9@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_4015_14056900.1136398644945 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Each SqlMapper use a different 'TLS' session store. Which iBATIS version do you use ? On 1/4/06, Michael Schall wrote: > > I need the ability to have muliple transactions / connections open to > the same database on the same thread at the same time. > > For example I want to: > 1) Open a connection and transaction (Session1) to a database > 2) Perform multiple inserts to tables in the database > 3) Commit and close (Session1) > > Easy right. > > My problem is that in order to perform the multiple inserts I need to > get / update information in another table. I have created multiple > DomSqlMapBuilders, configure them with different configuration files, > and store them as separate SqlMapper instances. So my example needs > to look like > > 1) Open a connection and transaction (Session1 on SqlMapper1) to a > database > 2) Open a connection and transaction (Session2 on SqlMapper2) to the > same database > 3) Get and Increment Counter (Session2) > 4) Commit and close (Session2) > 5) Perform insert to table in the database using counter (Session1) > 6) Open a connection and transaction (Session2) to the same database > 7) Get and Increment Counter (Session2) > 8) Commit and close (Session2) > 9) Perform insert to table in the database using counter (Session1) > 10) ... > 11) Commit and close (Session1) > > If for any reason I need to rollback (Session1) at step 10, the > actions performed on (Session2) should not be rolled back as they have > been committed. > > However when I try and do step 2 SqlMapper2 is already in a > transaction. It seems like due to the way the session is stored in > TLS, it will only allow for one session to be stored per thread. > > Is there a way to get this to work? I can submit code if that helps. > > Thanks for your time. > Mike > ------=_Part_4015_14056900.1136398644945 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Each SqlMapper use a different 'TLS' session store.
Which iBATIS version do you use ?

 
On 1/4/06, M= ichael Schall <mike.schall@= gmail.com> wrote:
I need the ability to have mulip= le transactions / connections open to
the same database on the same thre= ad at the same time.

For example I want to:
1) Open a connection and transaction (Ses= sion1) to a database
2) Perform multiple inserts to tables in the databa= se
3) Commit and close (Session1)

Easy right.

My problem i= s that in order to perform the multiple inserts I need to
get / update information in another table.  I have created mu= ltiple
DomSqlMapBuilders, configure them with different configuration fi= les,
and store them as separate SqlMapper instances.  So my ex= ample needs
to look like

1) Open a connection and transaction (Session1 on SqlMapper1) to a = database
2) Open a connection and transaction (Session2 on SqlMapper2) t= o the
same database
3) Get and Increment Counter (Session2)
4) Com= mit and close (Session2)
5) Perform insert to table in the database using counter (Session1)
= 6) Open a connection and transaction (Session2) to the same database
7) = Get and Increment Counter (Session2)
8) Commit and close (Session2)
9) Perform insert to table in the database using counter (Session1)
10) = ...
11) Commit and close (Session1)

If for any reason I need to r= ollback (Session1) at step 10, the
actions performed on (Session2) shoul= d not be rolled back as they have
been committed.

However when I try and do step 2 SqlMapper2 is a= lready in a
transaction.  It seems like due to the way the ses= sion is stored in
TLS, it will only allow for one session to be stored p= er thread.

Is there a way to get this to work?  I can submit code if= that helps.

Thanks for your time.
Mike
------=_Part_4015_14056900.1136398644945--