Java/JAVA 오류기록

[JAVA] nested exception is org.apache.ibatis.builder.BuilderException: Error evaluating expression 'Name'. Return value (hong) was not iterable.

냠냠쿠 2023. 11. 17. 14:16
728x90

 

마이바티스에 foreach문을 사용하는 경우 무조건 순회를 해야하기 때문에 String값을 바로 박으면 안된다.

 

문제가 되었던 코드 예시

String namelist = "hong";
param.put("Name", namelist);

이런식으로 바로 String형식이 때려박혀있었는데.

String[] namelist  = new String[1];
namelist[0] = "hong";
param.put("Name", namelist);

이런 형식으로 String 배열 형태로 바꾸어 넣어주면 오류가 해결된다. 

 

 

참고 : 

https://selfdevelope.tistory.com/694

 

Error evaluating expression.  Return value was not iterable.

jsp 에서 var cList = new Array(); cList.push("5"); cList.push("6"); 해서 값을 넘기고 mybatis에서 쓸려고 했는데 AND AA in #{C_MM,jdbcType=VARCHAR} org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.Buil

selfdevelope.tistory.com

 

728x90