ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Munat <b...@munat.com>
Subject Re: help problem with select request using 'in' where clause
Date Fri, 28 Jul 2006 15:51:32 GMT
The #[]# syntax is perfectly valid... I use it all the time. You use it when the parameter

itself is a collection, so you don't have a object.something option to use.

I don't think it works with Maps, however. Jeremy, why did you think you need a map? Oh, I

get it... for the very reason I just mentioned: you're looking for something to put in the

##.

It looks like it should work if you switch the parameter class back to java.util.List and

remove the property attribute on the iterate tag (there's only one property and the list 
is it).

hope that helps,

b

Firas Adiler wrote:
> Hi,
> 
> Two questions:
> 
> 1) What's with the "where #DONNE_UUID# in ..."? Did you mean:
> "where DONNE_UUID in ..."?
> 
> 2) Are you sure iBatis understands this syntax: #[]# ? I've read somewhere
> that it's not a valid syntax. In the "Developer's Guide" iBatis expect this
> parameter to be "a property of type java.util.List that is to be iterated
> over". You'd need some object/bean that returns these ids as a list, i.e:
> List SomeObj.getIds(). In you xml code you'd refer to it as #ids[]#
> 
> 
> Hope this helps,
> 
> </Firas>
> 
> -----Original Message-----
> From: jeb001 [mailto:jeremy.jardin@gmail.com] 
> Sent: Friday, July 28, 2006 9:21 AM
> To: user-java@ibatis.apache.org
> Subject: Re: help problem with select request using 'in' where clause
> 
> 
> Hi,
> 
> Thanks for your help.. but something still drives me crazy..
> 
> It seems that I sould pass a "java.util.Map" object and not a
> "java.util.List" in my select tag..
> So, I did that :
> 
> // that list contains ids I want to add in 'in' clause.
> List params = new ArrayList() ;
> 
> // I put it in a Map.       
> Map par = new HashMap() ;
> par.put("ids", params);
>         try
>         {
>             cards = sqlMap.queryForList("DONNEE.selectFromDonneeUUID", par);
> 
>         }
> 
> 
> My xmlFile :
> 
>    <select id="selectFromDonneeUUID"
> resultMap="abatorgenerated_DonneeResult" parameterClass="java.util.Map">
> 
>     select DONNEE_UUID,
>       DESCRIPTION,
>       LIBELLE,
>       TYPAGE,
>       EVALUATEUR,
>       TSTMPINSR,
>       TSTMPUPDT
>     from DONNEE
>     where #DONNE_UUID# in 
>     <iterate
>       open=" ("
>      close=")" conjunction="," property="ids">
>       #[]#
>     </iterate>
>   </select>
> 
> But it doesn't work.. 
> 
> --
> View this message in context:
> http://www.nabble.com/help-problem-with-select-request-using-%27in%27-where-
> clause-tf2009665.html#a5534831
> Sent from the iBATIS - User - Java forum at Nabble.com.
> 
> 

Mime
View raw message