Search code examples
ibatisloops

Java Ibatis Iterate List


Java i am using ibatis

using in clause want to iterate inside in clause, every one talking about following solution but when i try it gives me following error.

**Cause: com.ibatis.common.beans.ProbeException: There is no READABLE property named '[]' in class 'java.util.List'**


List entityIds = new ArrayList(2);
       entityIds.add(42167777);
       entityIds.add(43178455);

(List<EventCategory>)sqlMapClient.queryForList("getEventCategoryByEntityIds", entityIds);

<select id="getEventCategoryByEntityIds" parameterClass="java.util.List" resultMap="eventCategoryDetails">
    <![CDATA[
        SELECT E.EVENTCATEGORYID, ECAT.Name EVENTCATEGORYNAME, E.EVENTSUBCATEGORYID , ESUBCAT.Name EVENTSUBCATEGORYNAME  FROM
        Event E (nolock)
        JOIN EVENTCATEGORY ECAT (nolock) ON E.EventCategoryId=ECAT.EventCategoryId JOIN EVENTCATEGORY ESUBCAT ON E.EVENTSUBCATEGORYID=ESUBCAT.EventCategoryId 
        <dynamic prepend="where ENTITYID in ">
          <iterate open="(" close=")" conjunction=",">
          #[]#
          </iterate>
        </dynamic>
        ]]>
  </select>

I am sick and tried trying this solution but not working. any help appreciated..


Solution

  • After reading same kind of problem over the forum, I only removed the <![CDATA[ and it started working.

    Does anybody know why this happens? Please share with the rest of us.