Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 40115 invoked from network); 13 Oct 2009 05:39:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Oct 2009 05:39:04 -0000 Received: (qmail 5416 invoked by uid 500); 13 Oct 2009 05:39:03 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 5351 invoked by uid 500); 13 Oct 2009 05:39:02 -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 5343 invoked by uid 99); 13 Oct 2009 05:39:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Oct 2009 05:39:02 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [90.183.38.157] (HELO gmmr1.centrum.cz) (90.183.38.157) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Oct 2009 05:39:00 +0000 Received: from gmma1 (lb1-self.cent [10.20.11.5]) by gmmr1.centrum.cz (Postfix) with ESMTP id E7D1012002E13 for ; Tue, 13 Oct 2009 07:38:37 +0200 (CEST) Received: from gmmr3.centrum.cz ([127.0.0.1]) by gmma1 (gigamail-antispam); Tue, 13 Oct 2009 07:38:38 +0200 Received: from gmmr3.centrum.cz (lb1-self.cent [10.20.11.5]) by gmma1 (esets_smtp); Tue, 13 Oct 2009 07:38:38 +0200 Received: from mail1012.cent (lb1-self.cent [10.20.11.5]) by gmmr3.centrum.cz (Postfix) with SMTP id DEB1A18D9C for ; Tue, 13 Oct 2009 07:38:37 +0200 (CEST) Received: from localhost by localhost (Centrum Email Forwarder); Tue, 13 Oct 2009 07:38:35 +0200 To: Subject: Re: two parametr in Mapper method Received: from 94.113.5.165 (X-Forwarded-For: 94.113.5.165) by mail1012.centrum.cz (centrum.cz multimail) with HTTP Date: Tue, 13 Oct 2009 07:38:35 +0200 From: =?UTF-8?Q?Tom=C3=A1=C5=A1=20Proch=C3=A1zka?= References: <1254682800.817517.24647.nullmailer@mail1008.cent> <16178eb10910041434q640c6d34lf9065c6246368695@mail.gmail.com> <4AC95346.6060508@burntmail.com> <16178eb10910041952u5ad70db3ja712c1a7ed7628a4@mail.gmail.com> <4AC990C5.30603@burntmail.com> <16178eb10910060024w2d125a3bpd6aa8f688b997e57@mail.gmail.com> In-Reply-To: <16178eb10910060024w2d125a3bpd6aa8f688b997e57@mail.gmail.com> X-Mailer: Centrum Email 5.3 X-Priority: 3 MIME-Version: 1.0 X-Maser: oho Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <1255412315.025417.10864.nullmailer@mail1012.cent> X-EsetResult: clean X-CentrumSpamScore: +53 X-SpamDetected: 0 I tested it and it doesn't works for me. This works great now: @Select({"SELECT * FROM send LIMIT #{offset}, #{limit}"}) List getAllItems(@Param("offset") int offset, @Param("limit") int limit); but this not: I got: Exception in thread "main" org.apache.ibatis.exceptions.IbatisException: ### Error querying database. Cause: org.apache.ibatis.type.TypeException: JDBC requires that the JdbcType must be specified for all nullable parameters. ### The error may exist in SendMapper.xml ### The error may involve cz.apache.ibatis.SendMapper.getAllItemsX-Inline ### The error occurred while setting parameters ### SQL: select * from send LIMIT ?, ? ### Cause: org.apache.ibatis.type.TypeException: JDBC requires that the JdbcType must be specified for all nullable parameters. at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8) How Can I specify parametr types? ______________________________________________________________ > Od: "Clinton Begin" > Komu: user-java@ibatis.apache.org > Datum: 06.10.2009 09:33 > Předmět: Re: two parametr in Mapper method > >multiple parameters will require the XML equivalent parameter type to be >Map. Behind the scenes, it will do exactly what you do today -- wrap >multiple params in a Map. This keeps it simple and consistent. >Clinton > >On Mon, Oct 5, 2009 at 12:23 AM, Guy Rouillier wrote: > >> I'm glad to see you are considering allowing multiple parameters. I've >> found having to bind everything into one is cumbersome. >> >> What are you thinking of doing for XML? I'd suggest replacing >> ParameterType with ParameterList, with the latter a cut and paste from the >> mapper method. Your example below would look like: >> >> parameterList="int offset, int limit" >> >> From a programmer's perspective, I'd find the cut and paste easy, and >> iBatis would have everything it needs to enable named parameters in the SQL. >> >> Clinton Begin wrote: >> >>> There's no way to introspect on the parameter names. >>> So your choices become: >>> >>> @Select({"SELECT * FROM send LIMIT #{1}, #{2}"}) >>> List getAllItems(int offset, int limit); >>> >>> ...Or... >>> >>> @Select({"SELECT * FROM send LIMIT #{offset}, #{limit}"}) >>> List getAllItems(@Param("offset") int offset, @Param("limit") int limit); >>> >>> Both suck. But we'll probably default to the first, and allow for the >>> second. >>> Gross. >>> >>> Clinton >>> >>> On Sun, Oct 4, 2009 at 8:00 PM, Guy Rouillier >> guyr-ml1@burntmail.com>> wrote: >>> >>> I'd be curious to understand what the Java limitation is. I would >>> have thought that with Java 1.5's support of varargs, limitations >>> such as this would no longer exists. Of course, to use varargs >>> here, I suppose we'd have to use Object[], which would shoot your >>> type safety. >>> >>> Clinton Begin wrote: >>> >>> It's a limitation in Java. However, we are working on a couple >>> of potential options. But it's not possible to do it the way >>> you've written it (which is really sad, because it's perfectly >>> possible in C# and other languages). >>> >>> Clinton >>> >>> 2009/10/4 Tomáš Procházka >> >> >> >>> >>> >>> >>> Why not supported this? >>> >>> @Select({"SELECT * FROM send LIMIT #{offset}, #{limit}"}) >>> List getAllItems(int offset, int limit); >>> >>> >>> Its limitation of Java or bug in actual version? >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: >>> user-java-unsubscribe@ibatis.apacheorg >>> >>> >> > >>> >>> For additional commands, e-mail: >>> user-java-help@ibatis.apache.org >>> >>> >> > >>> >>> >>> >>> >>> -- Guy Rouillier >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org >>> >>> For additional commands, e-mail: user-java-help@ibatis.apache.org >>> >>> >>> >>> >> >> -- >> Guy Rouillier >> >> --------------------------------------------------------------------- >> 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