Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 15473 invoked from network); 13 May 2008 20:53:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 May 2008 20:53:06 -0000 Received: (qmail 76583 invoked by uid 500); 13 May 2008 20:53:07 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 75935 invoked by uid 500); 13 May 2008 20:53:06 -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 75924 invoked by uid 99); 13 May 2008 20:53:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 May 2008 13:53:06 -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 clinton.begin@gmail.com designates 209.85.146.177 as permitted sender) Received: from [209.85.146.177] (HELO wa-out-1112.google.com) (209.85.146.177) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 May 2008 20:52:20 +0000 Received: by wa-out-1112.google.com with SMTP id v33so3921127wah.24 for ; Tue, 13 May 2008 13:52:35 -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=7S+xCl1nsqZFrDhzAc5Ye60gA/NOPFPnWNhQbCGS2s0=; b=uvXglt50m/lib9pZ8RxJ1y7CGa8pbcI6Jz8V1OOh7EYcJLjCRtVqDqDHK8CX/HVu7rXUE67ZNGsZ3PaIoqcWABNWl60cHfKBcAawYcICPkIyCG7MayOwid2ghKmFKMV/pNwoiYPY5sdOJS9xBhLpPqcyc/80kDI8yd02vLOzIWg= 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=kp7WM6VWVJkp5k39nlv4I2WjRVJcFmuQNrR520gDbt4NeQJzJpf6YAkWj49xvPHcq6TWjlUuT1J8ZHqxEL4y0+Abb0ly648fK9sIG5KPslZrRtsYyQhLNU7UCwMgo9HGnGVdqmamA1KtGg5s6Vm4cXgi9ZVPA2C+RbgaJ3pwI1k= Received: by 10.114.184.11 with SMTP id h11mr159940waf.175.1210711954605; Tue, 13 May 2008 13:52:34 -0700 (PDT) Received: by 10.115.93.20 with HTTP; Tue, 13 May 2008 13:52:34 -0700 (PDT) Message-ID: <16178eb10805131352qef49247n1c5f22ec7f3d3f70@mail.gmail.com> Date: Tue, 13 May 2008 14:52:34 -0600 From: "Clinton Begin" To: user-java@ibatis.apache.org, joshjdevl@gmail.com Subject: Re: Dynamic queries w/o using tags in sql? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Checked: Checked by ClamAV on apache.org Josh, Some people do care enough about this to do something about it. And yes, Hibernate is able to support it easily, because it has dirty checking, object identity and generates the SQL for the update. iBATIS is a SQL based framework. It does not generate the SQL for you, nor does it track dirty state or object identity etc. It's pretty safe to say that iBATIS will never support this in any way, even if we do add SQL generation for convenience, the lack of dirty checking etc. will keep this from ever being a practical possibility. I recommend looking into your particular situation. I'd bet that it doesn't matter as much as you think it does, or if it does matter in one or two cases -- handle those cases as a performance tweak. To answer your question about best practices, I'm not sure anyone has ever told me that this was a fully agreed upon best practice, but I do know a lot of people that think that premature performance optimization is a practice to avoid... Cheers, Clinton On Tue, May 13, 2008 at 2:37 PM, Josh Joy wrote: > > > Hi, > > > > > If I have an sql like the following... > > > > > > > > > > Is there a way to instruct Ibatis to ignore nulls without having to actually > use a dynamic tag? I would just like to set my bean entity with the > properties that I want updated, and leave null the ones I want to ignore... > > I know in Hibernate there is a way to do this, is there an equivalent in > Ibatis? It seems like a lot of xml code to write for all my updates... > > Is this not a best practice not to have dynamic updates, because I'm unsure > why I would have to explicitly set this in the XML? As far as I know, SQL > updates (unless using a specific database vendor call) are on a per table > basis. Is it not recommended to have an entity and not always have to update > all the fields? If I wanted to modify the Ibatis API for my own needs for > the updates, where would someone recommend I start? > > > > > Thanks, > > Josh >