ibatis 查询异常 Parameter index out of range
2015-08-13 11:23
447 查看
<select id="qryUser" resultClass="java.util.HashMap" parameterClass="java.util.HashMap" > SELECT userId FROM sys_user WHERE 1=1 <isNotEmpty property="userId"> AND userId = "#userId#" </isNotEmpty> </select>
以上语句报错了
SqlMapClient operation; SQL []; \n
--- The error occurred while applying a parameter map. \n
--- Check the roleManagerSqlMap.qryUserAuthorityIds-InlineParameterMap. \n
--- Check the parameter mapping for the 'userId' property. \n
--- Cause: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: \n
--- The error occurred while applying a parameter map. \n
--- Check the roleManagerSqlMap.qryUserAuthorityIds-InlineParameterMap. \n
--- Check the parameter mapping for the 'userId' property. \n
--- Cause: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
查了半天,原来是因为
<isNotEmpty property="userId"> AND userId = "#userId#" </isNotEmpty>
这个#userId# 外面多了 双引号, 把双引号去掉好了
相关文章推荐
- Cool Android Apis 整理(一)
- Linux内核的Oops
- caffe syncedmen 程序分析
- Android百分比布局支持库介绍——com.android.support:percent
- 如何修改eclipse的默认字符集和修改中文乱码
- C++的Public.lib(Public.dll) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
- Google breakpad实战
- 百度搜索SDK开发者文档 乐点
- JavaScript的面向对象编程基础
- [leetcode] Implement strStr()
- openfire无法启动服务-------解决方案
- Scatter file
- POJ 1258 Agri-Net(最小生成树prim算法)
- quick 3.3final 编译成功 运行出错的问题
- -webkit-filter属性用来干什么
- 中日韩教科书中的历史
- 《Objective-C基础教程》第8章 Foundation Kit 介绍
- 继上一篇文章,由于本地限制,等后续整理在一起
- Chrome浏览器中的网上应用店如何加载
- mysql多字段唯一索引