Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 97701 invoked from network); 3 Oct 2008 19:15:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Oct 2008 19:15:36 -0000 Received: (qmail 50758 invoked by uid 500); 3 Oct 2008 19:15:34 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 50079 invoked by uid 500); 3 Oct 2008 19:15:33 -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 50068 invoked by uid 99); 3 Oct 2008 19:15:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Oct 2008 12:15:33 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jeffgbutler@gmail.com designates 209.85.217.10 as permitted sender) Received: from [209.85.217.10] (HELO mail-gx0-f10.google.com) (209.85.217.10) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Oct 2008 19:14:31 +0000 Received: by gxk3 with SMTP id 3so4615183gxk.0 for ; Fri, 03 Oct 2008 12:14:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=no0Wm0bX+YA+ECoMZjOqciMpFVgmm/yLJ5Fm0/NDD8I=; b=h0TyZtj7vEF6tOGlFfbLuIx31RpilllpWcse+DStR03eyuRkWacC8WWzBC62z3d2K/ UwqzVgzFMuIau8Y6VuyfxZHWFy7DD7SoyjW14Pj2Xwx+QMLdzaOsk/MLLxBoZgUgWKgb ikGobhpmdvwueNSRWZVJ0aFk0Kgv7xxaYnsYI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=s0G7rtAHlDUpyssh7ORqUfXTRXboAmKFxVus/8ut/OuSRH+3Fk2YxFj+a0vopzRY9P 8c+tNJNjajTAuY5sZRyZWjqt+abnwDnYmyox4FKAA2jBxgw4e1rWSXh4pCKb1lozKRmm Qy8Tnmp+jbctjGNc+STvBRNHESLac00+9CtbI= Received: by 10.90.55.9 with SMTP id d9mr1733849aga.49.1223061245686; Fri, 03 Oct 2008 12:14:05 -0700 (PDT) Received: by 10.90.79.15 with HTTP; Fri, 3 Oct 2008 12:14:05 -0700 (PDT) Message-ID: Date: Fri, 3 Oct 2008 14:14:05 -0500 From: "Jeff Butler" To: user-java@ibatis.apache.org Subject: Re: java.sql.SQLException: You cannot commit during a managed transaction In-Reply-To: <55efbd800810031205o57fff002r1bd39510521000d6@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <55efbd800810030353m260a675fq4079f3d9a88ae655@mail.gmail.com> <48E6124E.7040008@kinokai.de> <55efbd800810030601l3c1e3216g7734d7918c4b6eb0@mail.gmail.com> <48E62AC5.3060305@kinokai.de> <55efbd800810031144u7667b990p32f4f19a964d20b9@mail.gmail.com> <55efbd800810031205o57fff002r1bd39510521000d6@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org I think you should use EXTERNAL transaction manager - this is EXACTLY why it exists. JBOSS, not iBATIS, is your transaction manager in this case. Jeff Butler On Fri, Oct 3, 2008 at 2:05 PM, Chema wrote: > I don't want to keep the secret :-D > > > cacheModelsEnabled="true" > enhancementEnabled="true" > maxSessions="128" > maxTransactions="64" > maxRequests="512"/> > > > > > > > > > No more. > And like you said, I don't use an EXTERNAL tx manager, but JDBC type > > I think that the only solution is perform "delete" sentences by JDBC > API , so don't commit current transaction (managed by application > server). > What do you think ? > > > > > 2008/10/3 Jeff Butler : >> iBATIS will not call commit() if you have >> >> >> ... >> >> >> I'm guessing this is NOT what you have configured - but it would be >> nice to see your configuration. >> >> Jeff Butler >> >> On Fri, Oct 3, 2008 at 1:44 PM, Chema wrote: >>> I can't upgrade because my application runs over JVM 1.4 and iBatis >>> 2.3.0 is the last release compatible with JVM 1.4 >>> >>> About your question, from documentation: >>> >>> "The element also allows an optional attribute >>> commitRequired that can be true or >>> false. Normally iBATIS will not commit transactions unless an insert, >>> update, or delete operation has been performed >>> [...] >>> The startTransaction(), commitTransaction() and endTransaction() >>> methods, they will all be called >>> automatically for you whenever you execute a statement outside of a >>> transactional block as demonstrated in >>> the above." >>> >>> I think it's not by cause of my configuration >>> >>> Thanks ! >>> >>> Regards >>> >>> >>> >>> >>> 2008/10/3 Kai Grabfelder : >>>> sqlMap.delete() performs a commit? That should not be the case if the tx manager is configured correctly. >>>> Whats your configuration? Could you please also try updating ibatis to 2.3.4, 2.3.0 is really old... >>>> >>>> Regards >>>> >>>> Kai >>>> >>>> --- Original Nachricht --- >>>> Absender: Chema >>>> Datum: 03.10.2008 15:01 >>>>> That doesn't work because sqlMap.delete() performs commit automatically. >>>>> I'm using the transaction manager of JBoss , with JNDI/JDBC. >>>>> Can I disabled this ? By code is not possible because Jboss TX manager >>>>> throws a SQLExeception. >>>>> Another w/a ? >>>>> >>>>> Thanls ! >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> 2008/10/3 Kai Grabfelder : >>>>>> if you are using CTM (container managed transactions), like in your case, you can't start, commit or end >>>>>> transactions manually. The container is doing this for you. >>>>>> >>>>>> The following should work >>>>>>> sqlMap.delete("deleteRecords", param); >>>>>> >>>>>> If it does not I think your sqlmap configuration is not correct. Could you post it here? >>>>>> >>>>>> Regards >>>>>> >>>>>> Kai >>>>>> >>>>>> --- Original Nachricht --- >>>>>> Absender: Chema >>>>>> Datum: 03.10.2008 12:53 >>>>>>> Hello: >>>>>>> >>>>>>> I'm using JBoss 3.2 and EJB 2.0 with iBatis 2.3.0 >>>>>>> I've got configured a external transaction manager in SQLMap >>>>>>> configuration file. >>>>>>> >>>>>>> When an EJB component ( session bean ) tries to delete record using by >>>>>>> iBatis sqlMap client, JBoss retrieve this >>>>>>> error: >>>>>>> >>>>>>> 11:02:09,406 ERROR [Connection] Error calling Connection.commit: >>>>>>> java.sql.SQLException: You cannot commit during a managed transaction! >>>>>>> at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:525) >>>>>>> >>>>>>> >>>>>>> >>>>>>> This error happens when I perform this >>>>>>> >>>>>>> sqlMap.startTransaction(); >>>>>>> sqlMap.delete("deleteRecords", param); >>>>>>> sqlMap.commitTransaction(); >>>>>>> sqlMap.endTransaction(); >>>>>>> >>>>>>> >>>>>>> And with a single call (automatic transaction): >>>>>>> >>>>>>> sqlMap.delete("deleteRecords", param); >>>>>>> >>>>>>> >>>>>>> I would like to delegate all transaction issues to external >>>>>>> transaction manager ( in this case, JBoss) >>>>>>> How I can solved this ? Any w/a ? >>>>>>> >>>>>>> >>>>>>> Thanks !! >>>>>>> >>>>>> >>>>>> >>>>> >>>> >>>> >>> >> >