MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException


MyBatis 報了一個異常:

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

原因是因為在使用動態sql的時候,我想在<if test>中判斷某個屬性的值是否等於"Y", 報錯是因為一開始是這么寫的:

<if test="isKey == 'Y'">
	AND eq.is_key_eq = 'Y'
</if>

然后將單雙引號的順序改變一下,外層單引號,內層雙引號就OK了,這個設計讓我很蛋疼啊!!!

<if test='isKey == "Y"'>
	AND eq.is_key_eq = 'Y'
</if>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM