에러

[MyBatis] NumberFormatException 에러 해결

놋수저 2022. 2. 12. 11:37
반응형

[MyBatis] NumberFormatException 에러 해결

 

쿼리를 작성하고.. 파라미터로 String 값을 넘길 때 뜬금없이(?) NumberForatException이 발생한다...

 

<update id="updateCustomer">
	...
    <if test="status === 'Y'">
    	, updatedDate = SYSDATE
    </if>
    ...
</update>

org.mybatis.spring.MyBatisSystemException:

nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: java.lang.NumberFormatException: For input string: "Y"
### Cause: java.lang.NumberFormatException: For input string: "Y"

 

 

해결방법은 간단하다. if문 test를 감싸고 있는 따옴표 순서를 변경해주면 된다.

<update id="updateCustomer">
	...
    <if test='status === "Y"'>
    	, updatedDate = SYSDATE
    </if>
    ...
</update>
반응형
LIST