Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 51009 invoked from network); 5 Jan 2009 15:46:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Jan 2009 15:46:55 -0000 Received: (qmail 51161 invoked by uid 500); 5 Jan 2009 15:46:53 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 50949 invoked by uid 500); 5 Jan 2009 15:46:51 -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 50940 invoked by uid 99); 5 Jan 2009 15:46:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jan 2009 07:46:51 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jeffgbutler@gmail.com designates 209.85.217.11 as permitted sender) Received: from [209.85.217.11] (HELO mail-gx0-f11.google.com) (209.85.217.11) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jan 2009 15:46:44 +0000 Received: by gxk4 with SMTP id 4so5091185gxk.0 for ; Mon, 05 Jan 2009 07:46:23 -0800 (PST) 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=5gexj68DYi7N4ueY3s+lQIDKRI900WlKYw2kwdBQDzY=; b=GE35JOQzk+6Z3WJYgzfh9j4WjSowLGtBBZhQ2c60FpELzvL2Df/zN9r1xK4WDj4Rdo /2SZEUIMtRpuy79o0I2rDtlo4M1FpnUR8ed+WuAp4HKpMD8xQTdLkk1t2GGpnItQksxz CO5Konox8ua67BAc1rwbhzosV0/B3qywBZKPw= 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=mKG7e0ZEZya/Yos0pW3Wlm3Q6oL+ACdXnzapz/butqad9HR8TuJXV68ZbTOilCHcXV QFy6TuQXfyuh0ddtujfFhWHOggM57oP0/6D8enHsSiv5l17Gi8H9PAbVlzJRysQBCBal vD53OfcHFi2BH0IGAl0293JpLNVTL4/XPLt18= Received: by 10.150.135.2 with SMTP id i2mr40852984ybd.229.1231170382886; Mon, 05 Jan 2009 07:46:22 -0800 (PST) Received: by 10.151.40.4 with HTTP; Mon, 5 Jan 2009 07:46:22 -0800 (PST) Message-ID: Date: Mon, 5 Jan 2009 09:46:22 -0600 From: "Jeff Butler" To: user-java@ibatis.apache.org, asethi_im@yahoo.com Subject: Re: Dynamic Query and Prepared Statement Caching In-Reply-To: <622690.19073.qm@web59814.mail.ac4.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <622690.19073.qm@web59814.mail.ac4.yahoo.com> X-Virus-Checked: Checked by ClamAV on apache.org iBATIS does cache prepared statements. The cache is based on the SQL string that is created after the dynamic query is resolved. So if you have 300 different combinations of criteria, then you will have 300 cached prepared statements. Jeff Butler On Sun, Jan 4, 2009 at 9:01 PM, Anurag Sethi wrote: > Hi, > I am using the Abator generated queryByExample sql/DAO classes. I am specifically using the Criteria class in there and have a bunch of criteria ored in the example that I send as the parameter. > > So in general, I have the actual query with different number of criteria ored. > > Does Ibatis cache the resulting Prepared statements too? If not, what is the best way to make sure that the statements are not prepared every time the queryByExample interface is called. Its a big performance hit. > > I have also tried generating an sql map programatically as part of the bootstrap sequence and actually put in around 300 different static queries in there and call the one based on the number of criteria I would have had to or using the queryByExample dynamic query. This should at-least lead to caching of the prepared statements. Please correct me if I am wrong. > > Thanks, > Anurag > > > > >