ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: two parametr in Mapper method
Date Tue, 06 Oct 2009 07:24:38 GMT
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 <guyr-ml1@burntmail.com>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<mailto:
>> 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 <t.prochazka@centrum.cz
>>        <mailto:t.prochazka@centrum.cz> <mailto:t.prochazka@centrum.cz
>>        <mailto:t.prochazka@centrum.cz>>>
>>
>>
>>
>>           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
>>        <mailto:user-java-unsubscribe@ibatis.apache.org>
>>           <mailto:user-java-unsubscribe@ibatis.apache.org
>>        <mailto:user-java-unsubscribe@ibatis.apache.org>>
>>
>>           For additional commands, e-mail:
>>        user-java-help@ibatis.apache.org
>>        <mailto:user-java-help@ibatis.apache.org>
>>           <mailto:user-java-help@ibatis.apache.org
>>        <mailto:user-java-help@ibatis.apache.org>>
>>
>>
>>
>>
>>    --    Guy Rouillier
>>
>>
>>    ---------------------------------------------------------------------
>>    To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>    <mailto:user-java-unsubscribe@ibatis.apache.org>
>>    For additional commands, e-mail: user-java-help@ibatis.apache.org
>>    <mailto: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
>
>

Mime
View raw message