2014년 12월 16일 화요일

[MyBatis] parametertype string test (There is no getter for property named 'xxxx' in 'class java.lang.String')


Mybatis에서 parametertype이 String이나 int 같은 기본형인 경우

=============================
<if test="abc == null ">
    ...
</if>
=============================
위와 같이 사용시

There is no getter for property named 'abc' in 'class java.lang.String'
라는 에러 발생

...
이럴때는

=============================
<if test="_parameter == null ">
    ...
</if>
=============================
위와 같이 테스트할 파라미터 이름을 '_parameter' 로 바꿔주면
정상적으로 동작한다.





참고 :
http://devwa.com/47