犯了一个低级的错误,在传集合类型的参数时,把他当成字符串处理了,导致报类型转换的错误 把  and nsrsbh!=' ' 删掉就行了…
MyBatis中传参时为什么要用#{},这个问题和MyBatis如何防止SQL注入类似.不过在解释这个问题之前,先解释一下什么是SQL注入,还有些称作注入攻击这个问题. SQL注入就是SQL 对传入参数的拼接.sql语句是 String类型的,如果用  +  来拼接,表示的是直接操作这个String 类型的字符串,这是改变了sql的具体内容了,如果用#{id},表示的是操作字改变里面字段的参数值. 例如: 用+拼接的: "select * from user where code="+…
今天碰到个问题,来记录下,希望可以帮助到大家 贴错误源码: 这是一个根据list集合的查找数据的 sql,在接收list的时候加了判断 list != ‘ ’ “”,引起了集合与Stirng类型的比较,故报错 <if test="list != null and list != '' "> AND roo_id IN <foreach collection="list" item="id" index="index&q…
原文链接:http://blog.csdn.net/wanghailong_qd/article/details/50673144 mybatis异常invalid comparison: java.util.Date and java.lang.String 开发中改动mapper文件后需要重新编译发布, 由于工程比较大非常耗时, 所以为方便快速测试干脆写了一个小java工程. 工程中用到的dao, mapper和实体类都是从工程中拷出来的, 数据库也是同一个. 但是遇到一个比较奇怪的问题 实…
Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.String' 一.发现问题 <select id="queryStudentByNum" resultType="student" parameterType="string"> select num,name,phone from student  <where> <…
java.sql.SQLException: Invalid parameter object type. Expected 'java.util.Map' but found 'java.lang.String' 原文:http://hi.baidu.com/ideas/item/1e41172f70ac61876f2cc369 1 异常提示: com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred…
执行下面代码时报错: List<String> centerList = WebConstants.SUPPORT_BIG_CENTERS_LIST; // WebConstants.SUPPORT_BIG_CENTERS_LIST是Arrays.asList转化来的 centerList.removeAll(WebConstants.SUPPORT_CENTERS_LIST); centerList.addAll(WebConstants.SUPPORT_CENTERS_LIST); 最后一…
mybatis中使用动态sql,报错: invalid comparison: java.util.ArrayList and java.lang.String] with root cause 是由于  list != ' ' 导致的,引起了集合与string类型的比较 <if test="lsit != null and list != ''"> B.COMMID IN ( <foreach collection="list" item=&qu…
严重: Servlet.service() for servlet [spring] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### E…
The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory的异常的原因及解决办法原因: 是由于工程的WEB-INF/lib下存在jsp-api.jar.servlet-api.jar,与Tomcat自带的jar包冲突造成的. 解决办法: 删除WEB工程Lib目录中的jsp-api.jar.servlet-api.jar,重新启动Tomcat服务问题解决. 在创建工程时,jsp-a…