Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 70455 invoked from network); 9 Aug 2009 17:26:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Aug 2009 17:26:29 -0000 Received: (qmail 37986 invoked by uid 500); 9 Aug 2009 17:26:35 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 37935 invoked by uid 500); 9 Aug 2009 17:26:35 -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 37927 invoked by uid 99); 9 Aug 2009 17:26:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Aug 2009 17:26:35 +0000 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 harawata@gmail.com designates 209.85.146.180 as permitted sender) Received: from [209.85.146.180] (HELO wa-out-1112.google.com) (209.85.146.180) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Aug 2009 17:26:25 +0000 Received: by wa-out-1112.google.com with SMTP id n4so482571wag.0 for ; Sun, 09 Aug 2009 10:26: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:from:to :content-type:content-transfer-encoding:x-mailer:mime-version :subject:date; bh=whv6+MXr7m/ye4V4fCh4bXk4fuplpZ+okuDqhjPxnxs=; b=TZiOd5IjXLzhQ+7jzkNCCd9ktS36ZmldIODAKecYQLz0igJg0eCrOXxI9FAyBmuYBv 5wRtr/ou5Ixdwhjj+A5jByIyp9EtSLyk0Yc0E/CxzrntqyFyTgbvJoqo82dCnw8OHb1Y 4qsSr3XNXt51PLkaY18LJpaNRVjkSkwpdKHY8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:content-type:content-transfer-encoding:x-mailer :mime-version:subject:date; b=iuplT79DMRJ8H+H9Co7LRO+TewCSoqdsOJNPfUM3hnvCIYDe1CseQ5h3XKlOWhwlZE 7k1JJfpeTbHI5wLWsIWSWiuhFA9Qn4baZt66rMeQaHhBGq/RQaiCrYufgAddPGbWbwvH qncQeOKrecYr2yDI+1zSLncYCpuUos1muLbzM= Received: by 10.114.159.9 with SMTP id h9mr5196985wae.98.1249838765439; Sun, 09 Aug 2009 10:26:05 -0700 (PDT) Received: from ?126.254.63.77? (pw126254063077.14.tss.panda-world.ne.jp [126.254.63.77]) by mx.google.com with ESMTPS id k37sm17054277rvb.0.2009.08.09.10.25.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 09 Aug 2009 10:26:01 -0700 (PDT) Message-Id: <4B1F9DD9-0F54-402C-89DB-78F1937FD92B@gmail.com> From: Iwao AVE! To: "user-java@ibatis.apache.org" Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Mailer: iPhone Mail (7A341) Mime-Version: 1.0 (iPhone Mail 7A341) Subject: Re: Ibator: disable aliases for update and delete statements? Date: Mon, 10 Aug 2009 02:25:42 +0900 X-Virus-Checked: Checked by ClamAV on apache.org I actually have experienced a similar problem with MySql; the deleteByExample results in an syntax error when 'alias' is specified. Fortunately, there was an easy workaround that allows me to use alias in DELETE statement and I could write a plugin to tweak Ibator's default syntax. http://harawata.blogspot.com/2009/04/ibators-deletebyexample-and-mysql.html -- I cannot confirm this, but is the following syntax valid in SQL Server? If so, writing a simple plugin could be a solution for deleteByExample. DELETE u FROM User AS u WHERE u.xxx = ... Regards, Iwao On 2009/08/10, at 1:12, Jeff Butler wrote: > There's no support for this in Ibator now. It will take a rewrite of > the example class generator at the very least - with support from new > SQL element generators too. > > It also presents a bit of a usage problem for the iBATIS3 interface > mapper generator. I haven't released this yet, but will soon. > > So I'll have to think about this for a bit to come up with the best > way to deal with it. > > Don't you love how "standard" SQL is? I've never run into this in all > my testing, but I don't test with SQL Server regularly. No problems > in MySql, HSQLDB, DB2, and (I think) PostgreSQL. > > Jeff Butler > > > > On Sun, Aug 9, 2009 at 10:11 AM, Chad McHenry > wrote: >> Using SQL Server, I get syntax errors from Ibator generated >> deleteByExample >> and updateByExample* for tables which I give an alias. >> Neither deleteByPrimaryKey, updateByPrimaryKey, nor >> updateByPrimaryKeySelective use of the alias, and work, but >> deleteByExample, >> updateByExample, and updateByExampleSelective use the alias, and >> fail. >> I don't see a way to disable alias use in just the '*ByExample*' >> statements >> without creating "Example_Where_Clause_Without_Aliases" sql >> fragment, and >> using that instead of the "Example_Where_Clause", but that would >> take a lot >> of rewriting of the auto generated stuff or an Ibator plugin. >> Any suggestions? >> >> >> generates: >> > parameterClass="model.User"> >> >> delete from "user" >> where id = #id:VARCHAR# >> >> > parameterClass="model.UserExample"> >> >> delete "user" from "user" u >> >> >> deleteByPrimaryKey works fine, but deleteByExample fails with bad- >> syntax >> error, due to the aliases which SQLServer 2005 does not like in >> delete or >> update statements. >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org > For additional commands, e-mail: user-java-help@ibatis.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org For additional commands, e-mail: user-java-help@ibatis.apache.org