I am used ibatis 3.0 GA;

those are my JavaBean classes,

public class SearchObject {
 private Long id;
 private List<Long> childIdList = new ArrayList<Long>();
 public Long getId() {
        return id;
 }
 public void setId(Long id) {
        this.id = id;
 }
 public List<Long> getChildIdList () {
       return childIdList;
 }
 public void setChildIdList (List<Long> childIdList ) {
        this.childIdList = childIdList ;
 }
}

public class ResultObject {
 private String result;
 public String getresult() {
        return result;
 }
 public void setResult(String result) {
        this.result = result;
 }
}

and this is my sqlmapping file,

<select id="getView" parameterType="SearchObject "
resultType="ResultObject">
    select o.result from table o                   
     <where>
     <if test="id != null ">
        o.id = #{id}                    
     </if>      
     <if test="childIdList.size() > 0">
        and o.child in
        <foreach item="item" index="index" open="(" close=")" separator=","
collection="childIdList" >
             #{item}
        </foreach>
     </if>
    </where>
</select>

when I execute I got error:

### Error querying database.  Cause:
org.apache.ibatis.reflection.ReflectionException: There is no getter for
property named '__frch_item_0' in 'SearchObject'
### The error may involve sqlmap.Search.getView-Inline
### The error occurred while setting parameters
### Cause: org.apache.ibatis.reflection.ReflectionException: There is no
getter for property named '__frch_item_0' in 'SearchObject'
ERROR [STDERR] org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause:
org.apache.ibatis.reflection.ReflectionException: There is no getter for
property named '__frch_item_0' in 'SearchObject'
### The error may involve sqlmap.CCSalesOrderItem.getCCSOItemView-Inline
### The error occurred while setting parameters
### Cause: org.apache.ibatis.reflection.ReflectionException: There is no
getter for property named '__frch_item_0' in 'SearchObject'

If I change the sql mapping to this, 

<select id="getView" parameterType="SearchObject "
resultType="ResultObject">
    select o.result from table o                   
     <where>
     <if test="id != null ">
        o.id = #{id}                    
     </if>      
     <if test="childIdList.size() > 0">
        and o.child in
        <foreach item="item" index="index" open="(" close=")" separator=","
collection="childIdList" >
             #childIdList[${index}]
        </foreach>
     </if>
    </where>
</select>

I got this error:

### Error querying database.  Cause:
org.apache.ibatis.executor.ExecutorException: There was no TypeHandler found
for parameter childIdList[0] of statement sqlmap.Search.getView
### The error may involve sqlmap.Search.getView-Inline
### The error occurred while setting parameters
### Cause: org.apache.ibatis.executor.ExecutorException: There was no
TypeHandler found for parameter childIdList[0] of statement
sqlmap.Search.getView

where cause the error?
-- 
View this message in context: 
http://old.nabble.com/iBATIS-3-dynamic-sql-%27foreach%27-list-got-problem.-tp28814309p28814309.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org

Reply via email to