MyBatis异常处理org.apache.ibatis.executor.ExecutorException报错:A query was run and no Result Maps were fo
2020-08-10 17:22
1481 查看
今天在学习MyBatis是遇见了一个报错,记录下来。
在我配置好核心文件和映射文件并在会话工厂执行时出现了:MyBatis异常处理org.apache.ibatis.executor.ExecutorException并提示:
A query was run and no Result Maps were found for the Mapped Statement意思大概是:使用mybatis进行查询时,没有给定resultType值出现的错误。resultType是查询对象的类型
排查后发现是因为没有在映射文件指明查询结果的返回值类型:resultType的值,
我这里返回的是int类型,修改后再运行就没有问题了。
<?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="TeacherMapper"> <select id="countTeacher" resultType="int"> select count(*) from teacher </select> </mapper>
相关文章推荐
- MyBatis异常处理org.apache.ibatis.executor.ExecutorException
- mybatis插入出现org.apache.ibatis.executor.ExecutorException: No setter found for the keyProperty 'xxx'异常的原因
- 关于一些mybatis异常的原因:org.apache.ibatis.binding.BindingException: Parameter 'status' not found.
- 关于querying database. Cause: org.apache.ibatis.executor.ExecutorException: Executor was closed. 异常
- mybatis org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)异常解决
- MyBatis异常 No enum constant org.apache.ibatis.type.JdbcType.Decimal
- Mybatis异常-java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType.N...
- 异常处理:org.apache.ibatis.binding.BindingException:
- mybatis异常:org.apache.ibatis.binding.BindingException: Parameter 'param' not found. Available param
- mybatis异常:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.B
- mybatis映射异常:nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter
- mybatis 异常 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding
- mybatis异常:org.apache.ibatis.binding.BindingException: Parameter 'param' not found. Available param
- mybatis+springboot启动异常:Caused by: org.apache.ibatis.binding.BindingException: Invalid bound statemen
- mybatis 异常信息 org.apache.ibatis.reflection.ReflectionException: There is no getter for property named
- Mybatis异常--java.lang.IllegalArgumentException: NO ENUM const class org.apache.ibatis.type.JdbcType.int
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)异常处理办法
- org.apache.ibatis.binding.BindingException异常处理
- 解决mybatis遇到异常org.apache.ibatis.exceptions.PersistenceException
- Mybatis在级联查询时,遇到org.apache.ibatis.executor.ExecutorException: No constructor found in错误之分析与解决