MyBatis Cause: java.sql.SQLException: Operand should contain 1 column(s) 异常处理
来源:互联网 发布:华东师范大学vnp软件 编辑:程序博客网 时间:2024/06/03 18:22
用mybatis foreach出现异常Operand should contain 1 column(s)
<select id="selectByCreditIdList" resultMap="BaseResultMap"> SELECT * FROM table WHERE id IN ( <foreach collection="creditIdList" item="cid" index="index" open="(" close=")" separator=","> #{cid} </foreach> ) </select>
暴出的异常如下。
Error querying database. Cause: java.sql.SQLException: Operand should contain 1 column(s)### The error may exist in com/fengdai/finance/dao/CreditBillCycleDao.xml### The error may involve defaultParameterMap### The error occurred while setting parameters### SQL: SELECT * FROM credit_bill_cycle WHERE ( id IN ( ( ? , ? ) ) )### Cause: java.sql.SQLException: Operand should contain 1 column(s)
发现生成IN 后跟随的列表是一个( ? , ? ) ,因此产生Operand should contain 1 column(s)异常。删除MyBatis sql映射文件中的外围括号,问题解决。
( <-删除 <foreach collection="creditIdList" item="cid" index="index" open="(" close=")" separator=","> #{cid} </foreach>) <- 删除
0 1
- MyBatis Cause: java.sql.SQLException: Operand should contain 1 column(s) 异常处理
- java.sql.SQLException: Operand should contain 1 column(s)
- Caused by: java.sql.SQLException: Operand should contain 1 column(s)
- Operand should contain 1 column(s)
- Operand should contain 1 column(S);
- SQL查询字段添加括号报错:Operand should contain 1 column(s)
- operand should contain 1 columns(s)
- spring-data-jpa使用联合主键后出现operand should contain 1 column(s)
- Mysql语句报错Operand should contain * column解决办法
- Mybatis发生异常: Cause: java.sql.SQLException: ORA-00911: 无效字符
- Cause: java.sql.SQLException: Column count doesn't match value count at row 1
- Cause: java.sql.SQLException: Data truncated for column 'LOAN_SUM' at row 1
- 异常—Cause: java.sql.SQLException: Data source is closed
- Cause: java.sql.SQLException: Bad format for Time '308:42:13' in column
- . Cause: java.sql.SQLException: Incorrect string value: '\xE6\xB5\x8B\xE8\xAF\x95' for column 'name
- Java之POI读取Excel的Package should contain a content type part [M1.13]] with root cause异常问题解决
- 异常问题:java.sql.SQLException: Column count doesn't match value count at row 1
- 【Mybatis】Cause: java.sql.SQLException: sql injection violation, syntax error: ERROR. token : WHERE,
- 块设备与字符设备
- C++智能指针
- 创建第一个 local network(I)
- 高性能Ajax
- 创建第一个 local network(II)- 每天5分钟玩转 OpenStack(81)
- MyBatis Cause: java.sql.SQLException: Operand should contain 1 column(s) 异常处理
- Java 的容器类知识
- 何为函数指针
- 电子类的视频教程
- 道路游戏 动态规划
- Spring学习-06:IOC容器装配Bean(xml配置方式)详解
- 有关package和import
- 机房重构--数据库设计
- Glide 一个专注于平滑滚动的图片加载和缓存库