Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 59445 invoked from network); 28 Oct 2005 14:14:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Oct 2005 14:14:00 -0000 Received: (qmail 69878 invoked by uid 500); 28 Oct 2005 14:13:58 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 69841 invoked by uid 500); 28 Oct 2005 14:13:57 -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 69830 invoked by uid 99); 28 Oct 2005 14:13:57 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Oct 2005 07:13:57 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [217.12.10.193] (HELO web25808.mail.ukl.yahoo.com) (217.12.10.193) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 28 Oct 2005 07:13:53 -0700 Received: (qmail 9763 invoked by uid 60001); 28 Oct 2005 14:13:34 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=BDTQEFF2UMIQGSJFvsGtGacDTEYPheOx7zyHWn4ozIsI4Sfmtj6RgnlYDtSUNBgH/+SZkM1yNY/8ho61658VIkMP5CLviMEBo3zIpdWiMAE65zcMPZggglkOU2+z0g4Ag0F6ZjxPMQ5bCDryR1Ry3ks5y6ubSgQVgp9AivmkTto= ; Message-ID: <20051028141334.9761.qmail@web25808.mail.ukl.yahoo.com> Received: from [82.109.70.230] by web25808.mail.ukl.yahoo.com via HTTP; Fri, 28 Oct 2005 15:13:34 BST Date: Fri, 28 Oct 2005 15:13:34 +0100 (BST) From: Gareth Moorst Subject: Re: Parameter Maps AND dynamic sql at the same time To: user-java@ibatis.apache.org In-Reply-To: <1130507018.43622b0a1d47b@webmail.freedom2surf.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N So it does... Thanks for clearing that up. That's a bit of an arse as far as my datamodel is concerned though... In that case, as I'm only using Parameter Maps because I need to specify a custom type handler, does anyone know of a way to specify a type handler for a particular column without using a parameter map? Cheers, Gareth --- neilhenry@f2s.com wrote: > Hi > > In the iBatis-SqlMaps-2.pdf (page 16) it states: > > Note! Dynamic mapped statements (described below) only support inline parameters > and do not work with > parameter maps. > > Regards > Neil > > Quoting g m : > > > Well spotted - it appears I pasted the wrong xml > > fragment. My mistake. > > Here's the correct one, along with the parameter map > > I'm using. > > > > > parameterMap="SupplierExtrasParam"> > > insert into > compareValue="1">supplierextrastm > property="status" > > compareValue="0">supplierextras > > ( preferredsupplier, contactname, websiteaddress, > > companyregno, emailaddress, supplier) values (?, ?, ?, > > ?, ?, ?) > > > > > > > id="SupplierExtrasParam"> > > > > typeHandler="com.phones4u.datamanagement.datamodel.ibatis.typehandler.SmallIntBooleanTypeHandler"/> > > > > > > > > > > > > > > > > I've just tried it again to confirm the error (I > > played around with it a lot trying to get it to work, > > so I wanted to make sure that this sql fragment is > > definitely being called) and the error stops happening > > if I remove the element from the , > > giving me this debug output: > > > > > > DEBUG [AWT-EventQueue-0] - {pstm-100017} > > PreparedStatement: insert into supplierextrastm ( > > preferredsupplier, contactname, websiteaddress, > > companyregno, emailaddress, supplier) values (?, ?, ?, > > ?, ?, ?) > > DEBUG [AWT-EventQueue-0] - {pstm-100017} Parameters: > > [1, c, , c, , C] > > DEBUG [AWT-EventQueue-0] - {pstm-100017} Types: > > [java.lang.Short, java.lang.String, java.lang.String, > > java.lang.String, java.lang.String, java.lang.String] > > > > > > Cheers, > > Gareth. > > > > PS Apologies for the huge disclaimer - the legal > > department at my company have far too much time on > > their hands. > > --- Larry Meadors wrote: > > > > > There is something else going wrong here.. > > > > > > In the stack trace, it shows this message: > > > "Check the > > > Supplier.insertSupplierExtras-InlineParameterMap" > > > > > > That tells me that you were running > > > "insertSupplierExtras" with an inline > > > parameter map. > > > > > > But the statement sent was "updateSupplierExtras" > > > with an explicit parameter > > > map. > > > > > > I know that dynamic SQL and parameter maps work, so > > > I think we are missing > > > some pieces of the puzzle here. > > > > > > Larry > > > > > > > > > PS: Can you please trim the massive disclaimer, or > > > use another account when > > > posting? GMail is free, and works great for this > > > stuff. > > > > > > > > > On 10/28/05, Gareth Moorst > > > wrote: > > > > > > > > I'm trying to write insert/update statements that > > > can have their table > > > > dynamically altered, but I'm having problems with > > > any statements that use > > > > parameter maps... > > > > > > > > > > parameterMap="SupplierExtrasParam"> > > > > update > > > > > > compareValue="1">supplierextrastm > > property="status" > > > > > > > compareValue="0">supplierextras > > > set > > > > preferredsupplier = ?, > > > > contactname = ?, > > > > websiteaddress = ?, > > > > companyregno = ?, > > > > emailaddress=? > > > > where supplier=? > > > > > > > > > > > > If I use inline parameters, then I don't have a > > > problem, but when I try to > > > > use either a clause or a $tableName$ > > > clause in the map, I get this > > > > error : > > > > > > > > > > > > DEBUG [AWT-EventQueue-0] - {pstm-100017} > > > PreparedStatement: insert into > > > > supplierextrastm ( preferredsupplier, contactname, > > > websiteaddress, > > > > companyregno, emailaddress, supplier) values (?, > > > ?, ?, ?, ?, ?) > > > > DEBUG [AWT-EventQueue-0] - {pstm-100017} > > > Parameters: [] > > > > DEBUG [AWT-EventQueue-0] - {pstm-100017} Types: [] > > > > WARN [AWT-EventQueue-0] - Error saving supplier > > > > > > > org.springframework.jdbc.UncategorizedSQLException: > > > SqlMapClient > > > > operation; uncategorized SQLException for SQL []; > > > SQL state [IX000]; error > > > > code [-79749]; > > > > --- The error occurred while applying a parameter > > > map. > > > > --- Check the > > > Supplier.insertSupplierExtras-InlineParameterMap. > > > > --- Check the statement (update failed). > > > > --- Cause: java.sql.SQLException: Number of input > > > values does not match > > > > number of question marks; > > > > > > > > Looking at the trace, it seems that when I use any > > > form of dynamic sql, > > > > none of the parameters are passed. Is this the > > > correct behaviour? Is it > > > > possible to use dynamic sql and parameter maps at > > > the same time? > > > > > > > > I'm using iBatis 2.1.5. > > > > > > > > Cheers, > > > > Gareth Moorst > > > > > > > > > > > > > > > > > > > > > > > > > ___________________________________________________________ > > Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with > > voicemail http://uk.messenger.yahoo.com > > > > > > ___________________________________________________________ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com