재유's

[Error : Mybatis] There is no getter for property named 'columnNm' in 'class...' 본문

IT Story/ : : Error

[Error : Mybatis] There is no getter for property named 'columnNm' in 'class...'

Stella_NY 2019. 1. 4. 13:18

org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'columnNm' in 'class....'


라는 에러는 처음 봤다.



원인은 Mapper.xml(SQL이 있는 xml파일) 에서 if test 태그를 사용중인데 그곳에서 사용한 변수명과 result Map에 정의한 변수명이 달라 얘가 SQL태그에서 변수를 못찾아 생긴 에러였다.


ed)

 <resultMap .... >

 <result property = "colNm" column="colNm" />

    .

    .

    .

 </resultMap>

 .

 .

 <select ...>

   SELECT ...

   FROM TBL_NAME

   WHERE 1=1

   <if test = "col_nm != null">

     AND colNm = #{colNm}

   </if>

  </select>


위처럼 작성해서 틀린 에러였다 ㅜㅜ


난 문장 대충읽고 There is no getter라는말에 

'응?? 자동완성시켰는데 getter setter가 없다고?'라고 생각해 버렸다 ㅎㅎ


그냥 내가 오타낸거 ㅜㅜ


오타 주의하자!

Comments