Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 87212 invoked from network); 5 Mar 2008 17:54:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Mar 2008 17:54:56 -0000 Received: (qmail 25663 invoked by uid 500); 5 Mar 2008 17:54:47 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 25654 invoked by uid 500); 5 Mar 2008 17:54:47 -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 25640 invoked by uid 99); 5 Mar 2008 17:54:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Mar 2008 09:54:46 -0800 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 clinton.begin@gmail.com designates 209.85.146.182 as permitted sender) Received: from [209.85.146.182] (HELO wa-out-1112.google.com) (209.85.146.182) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Mar 2008 17:54:09 +0000 Received: by wa-out-1112.google.com with SMTP id j5so1601272wah.24 for ; Wed, 05 Mar 2008 09:54:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:references:in-reply-to:subject:date:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:content-language:message-id; bh=GfluQw0VqXIHn7z2QVhEn1YlmmBZQehCGacFlnQVPIs=; b=HyxQNN0P70EtJynUURXALrmdx4lL345ZgVX1zIPsUUwEZG0+0xTMEAb8I3JH7r4nyUtUGHQ8WYVTYWtiVP2yBoBzxztoE6XCQzko4RP1KMkUBz0ALUlpOVxvUF4Kn5f2/XHlXGpIx/U9hl4u0SYHH57x2mduWgoJMzQ6SZE84OY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:references:in-reply-to:subject:date:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:content-language:message-id; b=ooTDk8oxyp/wp7/xkhx6kLnZUo39JT//2K6LRZ/92evlYYq5VuFEjEhE/jHmWB+7REFBR4je9FeXvn+twy32PSySuAvGM6Qo7GQas+14wXie+2Cz5KbFBaO/1ufRbrZambBJED8XhA3OhSQfZyiQLg4lt907ME7sstFMNwhFb6I= Received: by 10.114.67.2 with SMTP id p2mr5013619waa.1.1204739659753; Wed, 05 Mar 2008 09:54:19 -0800 (PST) Received: from DARKSTAR ( [24.66.203.119]) by mx.google.com with ESMTPS id j21sm579866wah.45.2008.03.05.09.54.18 (version=SSLv3 cipher=OTHER); Wed, 05 Mar 2008 09:54:19 -0800 (PST) From: "Clinton Begin" To: References: <7A830B033BF360489B6EE305697CD09D0112A12D@mailhost01> In-Reply-To: Subject: RE: queryForList/Map/Object... rollbacks Date: Wed, 5 Mar 2008 10:54:05 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ach+QxzbEf9HhyrMQo+ARQMG4NTYPgACfx1wAAHyaQkAAMDNgAAEzTkoAB9erbkAADeoEA== Content-Language: en-ca Message-ID: <47cede4b.15ec720a.1c78.ffffa91f@mx.google.com> X-Virus-Checked: Checked by ClamAV on apache.org That's a good point as well, Chris. If you use Spring, it will manage the transaction fully, using whatever JDBC driver/datasource combination it has configured. You could also use setUserConnection() if you want to bypass the transaction manager entirely. The one exception is that you'll still need to provide datasource configuration for lazy loaded mappings, as iBATIS will allow you to lazy load associations after closing a session. That's an anti-pattern though, so it should be rare that you actually do that (and iBATIS 3 may not even support it). Clinton -----Original Message----- From: Christopher Lamey [mailto:clamey@localmatters.com] Sent: March-05-08 10:45 AM To: user-java@ibatis.apache.org Subject: Re: queryForList/Map/Object... rollbacks Doh! Forgot about "commitRequired" - been using Spring for everything lately. Sorry about that. On 3/4/08 7:46 PM, "" <> wrote: > Actually, it is the default behaviour. :-/ > > It's a combination of both the iBATIS transaction manager default > configuration and SimpleDataSource. > > To make a long story short, in the good old days, some JDBC drivers > literally required a rollback to "reset" the connection. *cough* Sybase > *cough* But other drivers hissed and booed at the excessive rollbacks. > > Thus we added a flag to the iBATIS transaction manager, called > commitRequired (because commits are equally as aggressive). Try this: > > > > That combined with a container managed DataSource should eliminate all > unnecessary rollbacks. If it was already set to false, it is entirely > possible that SimpleDataSource was entirely responsible for the aggressive > rollbacks -- thus we should probably make that configurable too. > > Clinton > > -----Original Message----- > From: Christopher Lamey [mailto:clamey@localmatters.com] > Sent: March-04-08 5:07 PM > To: user-java@ibatis.apache.org > Subject: Re: queryForList/Map/Object... rollbacks > > That is not the default iBATIS behavior, I'm guessing your container is > getting involved. > > From what I understand, the SIMPLE datasource type is generally for > standalone programs, not for apps running in a container. > > On 3/4/08 4:20 PM, "Tom Henricksen" wrote: > >> Currently we are using JDBC with simple datasource. >> >> >> >> >> >> >> >> >> >> But we are transitioning to JNDI datasource. >> >> >> >> This is just a web application. I will take a look at the Wiki. >> >> >> >> So is this default behavior of iBatis to create a transaction and roll >> it back for even a select? >> >> >> >> Would JTA change this? >> >> >> >> Thanks, >> >> Tom >> >> >> >> >> >> -----Original Message----- >> From: Jeff Butler [mailto:jeffgbutler@gmail.com] >> Sent: Tuesday, March 04, 2008 3:53 PM >> To: user-java@ibatis.apache.org >> Subject: Re: queryForList/Map/Object... rollbacks >> >> >> >> What transaction manager are you using? >> >> Is this an EJB application with CMT, or just a web application? >> >> Have you read the information in the WIKI about configuring iBATIS on >> WebSphere? >> >> >> >> http://opensource.atlassian.com/confluence/oss/display/IBATIS/Environmen >> t+Specific+Information >> >> >> >> Jeff Butler >> >> >> >> >> >> On Tue, Mar 4, 2008 at 3:32 PM, Tom Henricksen wrote: >> >> We are performance monitoring our application and my DBA let me know >> that we had over 3 MILLION rollbacks in a single day. We are using >> WebSphere to DB2 on Win2k3 servers. >> >> I looked in our code and could not find anything. Used p6spy and found >> that every time queryForXXX is called I received a rollback. Stepping >> through the queryForList code in SqlMapExecutorDelegate.java the >> autoStartTransaction starts a transaction if none is present and since >> we don't have commitRequired set, the autoEndTransaction will cause a >> rollback. >> >> I assume there is a good reason to start the transaction here. It seems >> like extra work creating a transaction that will always be rolled back. >> Can someone explain why this is good to me so I can forward the >> information to my DBA? Any links supporting the argument would be >> great. Is there a way to use the queryForXXX without creating a >> transaction? I assume it is better to not have commitRequired? >> >> Thanks for your time. >> >> >> >> Tom Henricksen >> Consultant >> Advanced Technologies Group, Inc. >> >> >> >> >> >