티스토리 뷰

Mybatis에서 Enum 타입이 포함된 VO 객체를 하나만 전달 받아서 넣을 때는 정상적으로 enum 타입을 insert 했다. 그런데 list로 받도록 소스를 수정하면서 foreach로 객체를 한번에 insert 했더니 다음과 같은 에러 메시지가 발생했다.

Type handler was null on parameter mapping for property '__frch_item_0.type'. It was either not specified and/or could not be found for the javaType (java.lang.Enum) : jdbcType (null) combination. 




해결


아래와 같이 enum 타입 객체를 받을 때, typeHandler=org.apache.ibatis.type.EnumTypeHandler을 추가해주면 된다.


<foreach collection="list" item="item" separator=",">
(
#{item.pollutant},
#{item.type, typeHandler=org.apache.ibatis.type.EnumTypeHandler},
)
</foreach>


댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함