mybatis xml 参数numberformatException
来源:互联网 发布:海报模板网站 知乎 编辑:程序博客网 时间:2024/06/04 18:51
错误描述
<select id="sltTreatment" resultType="com.vitaminmd.sunny.core.bo.Treatment"> select * from treatment where TRUE <if test="index == 'A'"> AND ensubject IS NOT NULL AND ensubject <> '' </if> </select>
当使用的index为A时,这段便抛出一个NumberFormatExeption的异常,但是如果index为一个数值比如1时就运行正常。
解决方案:
1.改为:test="param eq 'A'.toString()"
2.原因是mybatis标签语法的问题:
这里 'A' 将被认为是 char 类型,但是 'AA' 或者 "A" 将被作为 String类型。
所以我们可以用转义:<if test="name == "A"">
3.或者将 <if test="index == 'A'"> 改为 <if test='index == "A"'>。
0 0
- mybatis xml 参数numberformatException
- Mybatis的Mapper.xml中<if test>报NumberFormatException
- mybatis的NumberFormatException错误
- mybatis xml 参数 使用
- Mybatis 字符参数出现Error querying database. Cause: java.lang.NumberFormatException: For input string: "李
- NumberFormatException
- numberformatException
- NumberFormatException
- myBatis test 表达式抛出 NumberFormatException 错误的解决办法
- Mybatis if语句对比string时提示NumberFormatException
- mybatis java.lang.NumberFormatException: For input string: "G"
- Mybatis的if test字符串比较 报NumberFormatException错误
- MYBATIS 的参数传递及XML内使用
- spring+Mybatis+Ehcache整合(Ehcachec参数说明XML配置)
- MyBatis DAO层传递参数到mapping.xml
- mybatis-generator扩展教程系列 -- 自定义generatorConfig.xml参数
- mybatis传入map参数之后xml文件中取值问题
- 关于Mybatis中mapper.xml的传入参数简单技巧
- 多继承(非虚继承)派生类对象内存结构(基类有虚函数)
- Android Handler Message总结(传递参数)
- cocos2d-x 3.x中lua调用原理1--从基本的c++与lua互相调用开始
- python socket编程入门(一)
- Android 开发之static引发的冤案
- mybatis xml 参数numberformatException
- php中交互部分的总结
- Unity3D——汽车游戏自学1
- c语言基础问题汇总
- 一个c++类,尽可能标准
- 互质的数取模一定有循环节?
- C#通过发送 http 请求调用接口之Post
- struct vsf_sysutil_statbuf
- Android Camera学习总结:如何在android中使用摄像头获取照片