ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Niemeyer <nieme...@freenet.de>
Subject Re: iBatis 3: dynamic sql and numeric property type problem
Date Mon, 07 Jun 2010 10:57:02 GMT
Hi,
I've another use case for a possible if check:

- if the parameterType long it fails for the if check:

<select id="getMegaList" resultType="Mega" parameterType="long"> 		
    Select
    	id, descr, description from mega_t
    <where>
    	<if test="id != -1">
		id = #{id}
	</if>
    </where>	
  </select>


Thank you in advance,
Andreas



Andreas Niemeyer schrieb:
> Sorry, I had a missunderstanding, it works this way:
> 
> ...
> <if test="id != -1">
>     and x.id = #{id}    
> </if>   
> ...
> 
> Andreas Niemeyer schrieb:
>> Hi,
>>
>> how can I deal with numeric class properties for dynamic sql in iBatis 
>> 3.x? In the older 2.x release there exist a `<isGreaterThan>' tag and 
>> the user guide for 3.x only mentioned the <if> condition. For that, I 
>> get a NumberFormatException:
>>
>> Caused by: java.lang.NumberFormatException: For input string: "{0=null}"
>>
>>
>> The example looks like:
>>
>> <select id="getSomeList" resultType="SomeClass" 
>> parameterType="SomeConditionClass">
>>          select
>>             <include refid="someColumns"/>
>>         from
>>             hmm_t t, context_x x
>>         where
>>             t.id = x.id_hmm                              <if 
>> test="#{id} != -1">
>>                 and x.id = #{id}                </if>              
>> </select>
>>
>>
>> Thank you in advance,
>> Andreas


---------------------------------------------------------------------
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