mybatis报错:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exception
来源:互联网 发布:python 爬虫 知乎 编辑:程序博客网 时间:2024/04/26 00:27
接口配置:
package mybatis.mapper;import java.util.List;public interface TestMapper {public List<String> selectAllInfo();}
mapper.xml配置:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="mybatis.mapper.TestMapper"> <select id="selectAllInfo" resultType="java.util.List"> SELECT ID FROM TEST </select></mapper>
在使用junit测试时出现以下错误:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang.UnsupportedOperationException### The error may exist in mybatis/mapper/TestMapper.xml### The error may involve defaultParameterMap### The error occurred while setting parameters### SQL: SELECT ID FROM TEST### Cause: java.lang.UnsupportedOperationException
大致意思就是设置的参数有问题。
问题原因:
原因就在于mapper.xml的resultType代表的是List中的元素类型,而不应该是List本身,所以修改mapper.xml文件为:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="mybatis.mapper.TestMapper"> <select id="selectAllInfo" resultType="java.lang.String"> SELECT ID FROM TEST </select></mapper>
2 3
- mybatis报错:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exception
- MyBatis批量更新报错org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.bindin
- Spring+mybatis错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.bi
- Spring+MyBatis 错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.b
- mybatis异常:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.B
- mybatis 异常 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding
- Spring错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.Bi
- Spring错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.B
- Spring错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.Bi
- nested exception is org.mybatis.spring.MyBatisSystemException
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Persiste
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorEx
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Reflecti
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingExce
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Reflecti
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Reflecti
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Persiste
- 数据结构与算法JavaScript - 字典
- JS控制台打印
- BeanUtils.copyProperties忽略null值
- 构造IOCTL命令的学习心得-----_IO, _IOR, _IOW, _IOWR 幻数的理解
- vs2015不支持ArcGIS Engine以及丢失控件和模板解决办法
- mybatis报错:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exception
- Alpha混合物体的深度排序
- 操作系统——虚拟内存管理
- ffmpeg参数说明(转载)
- soapui与webservice接口测试[3]
- javaweb学习总结(十)——HttpServletRequest对象(一)
- 黑马程序员:C/C++薪资再创纪录,平均薪资11054元!
- redis教程
- php中引用&的真正理解-变量引用、函数引用、对象引用