본문 바로가기

IT/JAVA(Framework)

[Mybatis] java.lang.NumberFormatException: For input string 에러 해결방법

반응형

Mybatis에서 boolean으로 비교하는 조건 작성을 아래와 같이 작성을 했더니 java.lang.NumberFormatException: For input string: "true" 에러가 나왔다.

<if test='isAtchFile == "true"'>
    SQL문
</if>
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: java.lang.NumberFormatException: For input string: "true"
### Cause: java.lang.NumberFormatException: For input string: "true"
	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:79) ~[mybatis-spring-1.3.0.jar:1.3.0]
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:447) ~[mybatis-spring-1.3.0.jar:1.3.0]
	at com.sun.proxy.$Proxy28.update(Unknown Source) ~[?:?]

에러 화면

 

조치결과 

test='isAtchFile == "true"'  => test='isAtchFile == true'

<if test='isAtchFile == true'>
    SQL문
</if>

 

true에 쌍따옴표를 삭제 했더니 boolean으로 비교 잘 된다~

반응형