Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 67068 invoked from network); 6 Jul 2006 06:47:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 6 Jul 2006 06:47:03 -0000 Received: (qmail 47091 invoked by uid 500); 6 Jul 2006 06:46:56 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 47009 invoked by uid 500); 6 Jul 2006 06:46:56 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 46974 invoked by uid 99); 6 Jul 2006 06:46:55 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2006 23:46:55 -0700 X-ASF-Spam-Status: No, hits=2.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,RCVD_IN_BL_SPAMCOP_NET,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of hwangma@gmail.com designates 72.14.214.198 as permitted sender) Received: from [72.14.214.198] (HELO hu-out-0102.google.com) (72.14.214.198) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2006 23:46:55 -0700 Received: by hu-out-0102.google.com with SMTP id 31so1421488huc for ; Wed, 05 Jul 2006 23:46:31 -0700 (PDT) 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=YRl41O2rELLkrXtksGtAZI4viXr9AoLo/iayzBu/BUlrkeDSJ0WfxZsi4+TauFTbnPOFQVq4LbMxuyy+JsIJTDdMlm3IGWRLirky/yldGm/6WUGyjVbDSpWv9XAokMH/OTFN+0Fu3ztWEaNA2nesJjV2ej61XwyontircuhDwak= Received: by 10.67.29.12 with SMTP id g12mr308701ugj; Wed, 05 Jul 2006 23:46:31 -0700 (PDT) Received: by 10.66.255.14 with HTTP; Wed, 5 Jul 2006 23:46:31 -0700 (PDT) Message-ID: <1a79a8700607052346i153ef1acj91a59b036470b52f@mail.gmail.com> Date: Thu, 6 Jul 2006 15:46:31 +0900 From: "Hoyoung Hwang" To: user-java@ibatis.apache.org Subject: Re: how can i use mutiple transction in thread? In-Reply-To: <16178eb10607052216m14131bc4y480d12580c90cbf2@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_25766_11646517.1152168391095" References: <1a79a8700607031819p624bae32wa32569647d7e497b@mail.gmail.com> <16178eb10607051235y52f8dc69sbdc984b6d6c11bf4@mail.gmail.com> <1a79a8700607051902l45bc0b17lb3890033654a510c@mail.gmail.com> <16178eb10607052216m14131bc4y480d12580c90cbf2@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_25766_11646517.1152168391095 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline thanks, but that doesn't work. i try below code. SqlMapSession sess1 = SqlMapClientBase.openSession(); SqlMapSession sess2 = SqlMapClientBase.openSession(); if(sess1 == sess2) System.out.println("equal"); // <-- this code return true. sess1.startTransaction(); sess2.startTransaction(); // <-- error occure : TransactionManager could not start a new transaction. A transaction is already started. sess1.update("table1.update", table1Bean); sess2.update("table2.update", table2Bean); sess2.commitTransaction(); sess2.endTransaction(); sess1.commitTransaction(); sess1.endTransaction(); i want to use transaction, both of sessions. and each session is not depdent to another session. On 7/6/06, Clinton Begin wrote: > > > Use openSession() twice...don't call .startTransaction directly on the > SqlMapClient for either of them. > > Cheers, > > Clinton > > > > On 7/5/06, Hoyoung Hwang wrote: > > > > thans for your answer. > > > > but, i need not nested transaction. > > (yes, if ibatis support that, i use that model.) > > > > i want to use muliple transaction (or connection) model. > > > > i need second transaction is commit immediately. > > not dependent first transaction. > > > > in first transaction is processing, > > another transaction can commit at same thread. > > > > in example-------------- > > sqlmapclient.startTransaction(); //first transaction start > > sqlmapclient.insert("table.insert",table); > > newTrans = sqlmapclient.openSession(); > > newTrans.startTransaction(); //second transaction start , > > but it is not work. > > newTrans.insert("logtable.insert",logtable); > > newTrans.commitTransaction(); > > sqlmapclient.delete("table.delete",null); > > sqlmapclient.commitTransaction(); > > > > > > On 7/6/06, Clinton Begin wrote: > > > > > > > > > Regardless....the JDBC driver and/or database likely doesn't support > > > this. Few databases do. I think Sybase (and SQL Server?) support nested > > > transactions, but they're not recommended. Oracle supports savepoints, > > > which is somewhat cleaner...but ideally you should probably just simplify > > > your transaction model so that this isn't required. > > > > > > > > > Clinton > > > > > > > > > > > > On 7/5/06, Jeff Butler wrote: > > > > > > > > iBATIS does not support nested transactions like this. > > > > > > > > Jeff Butler > > > > > > > > > > > > On 7/3/06, Hoyoung Hwang wrote: > > > > > > > > > > i can't use muitple transaction. > > > > > how can i use mutiple transction? > > > > > > > > > > i don't use daoManager. just using SqlMap. > > > > > > > > > > example. > > > > > > > > > > sqlmapclient.startTransaction(); > > > > > sqlmapclient.insert("table.insert",table); > > > > > newTrans = sqlmapclient.openSession(); > > > > > newTrans.startTransaction(); > > > > > newTrans.insert("logtable.insert",logtable); > > > > > newTrans.commitTransaction(); > > > > > sqlmapclient.delete("table.delete",null); > > > > > sqlmapclient.commitTransaction(); > > > > > > > > > > please let me know. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ------=_Part_25766_11646517.1152168391095 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
thanks, but that doesn't work.
i try below code.

  SqlMapSession sess1 = SqlMapClientBase.openSession();
  SqlMapSession sess2 = SqlMapClientBase.openSession();
  if(sess1 == sess2) System.out.println("equal");    // <-- this code return true.
  sess1.startTransaction();
  sess2.startTransaction(); // <-- error occure : TransactionManager could not start a new transaction.  A transaction is already started.
  sess1.update("table1.update", table1Bean);
  sess2.update("table2.update", table2Bean);
  sess2.commitTransaction();
  sess2.endTransaction();
  sess1.commitTransaction();
  sess1.endTransaction();

i want to use transaction, both of sessions.
and each session is not depdent to another session.
 
 
 
 
On 7/6/06, Clinton Begin <clinton.begin@gmail.com> wrote:

Use openSession() twice...don't call .startTransaction directly on the SqlMapClient for either of them.

Cheers,
 
Clinton                 

            

On 7/5/06, Hoyoung Hwang <hwangma@gmail.com> wrote:
thans for your answer.
 
but, i need not nested transaction.
(yes, if ibatis support that, i use that model.)
 
i want to use muliple transaction (or connection) model.
 
i need second transaction is commit immediately.
not dependent first transaction.
 
in first transaction is processing,
another transaction can commit at same thread.
 
in example--------------
sqlmapclient.startTransaction();         //first transaction start
sqlmapclient.insert("table.insert",table);
newTrans = sqlmapclient.openSession();
newTrans.startTransaction();              //second transaction start , but it is not work.
newTrans.insert("logtable.insert",logtable);
newTrans.commitTransaction();
sqlmapclient.delete("table.delete",null);
sqlmapclient.commitTransaction();

 
On 7/6/06, Clinton Begin <clinton.begin@gmail.com > wrote:

Regardless....the JDBC driver and/or database likely doesn't support this.  Few databases do.  I think Sybase (and SQL Server?) support nested transactions, but they're not recommended.  Oracle supports savepoints, which is somewhat cleaner...but ideally you should probably just simplify your transaction model so that this isn't required.
 

Clinton



On 7/5/06, Jeff Butler <jeffgbutler@gmail.com > wrote:
iBATIS does not support nested transactions like this.
 
Jeff Butler

 
On 7/3/06, Hoyoung Hwang <hwangma@gmail.com> wrote:
i can't use muitple transaction.
how can i use mutiple transction?
 
i don't use daoManager. just using SqlMap.
 
example.
 
sqlmapclient.startTransaction();
sqlmapclient.insert("table.insert",table);
newTrans = sqlmapclient.openSession();
newTrans.startTransaction();
newTrans.insert("logtable.insert",logtable);
newTrans.commitTransaction();
sqlmapclient.delete("table.delete",null);
sqlmapclient.commitTransaction();
 
please let me know.
 
 





------=_Part_25766_11646517.1152168391095--