Hi all; I am new to iBatis, the application that I am working on requires return a list of object by a list of primary Keys. I am using < iterate> tag.
I would like the returned object list preserve the inline parameter’s order, I understand that MySQl will not honor the returned list order by query like this “select id from ATABLE where id IN (?, ?, ?)”, so I guess iBatis could not guarantee the returned order neither. Currently I am using a map to map the resulted object with the object id, and iterate through the id list, regenerate an ordered object list which will be the some order as inline list. Since there are many places need to return ordered object according to inline list of Ids, wondering if there is a general solution or iBatis could implement a parameter in sql map, (some thing like order=”true”): For example: <resultMap id="idResult" class="com.test.testObject"> <result property="id" column="id" /> <result property="value" column="column1" /> </resultMap> <select id="getIds" resultMap=" idResult " parameterClass="java.util.Map" order=”true “> SELECT id, column1 FROM table1 WHERE id IN <iterate property="idlist" open="(" close=")" conjunction=","> #idlist[]# </iterate> </select> many thanks Bill __________________________________ Do you Yahoo!? Yahoo! Mail - Find what you need with new enhanced search. http://info.mail.yahoo.com/mail_250