SpringBoot问题之org.apache.ibatis.executor.ExecutorException: No constructor found in...的问题
来源:互联网 发布:三观不正的电视剧知乎 编辑:程序博客网 时间:2024/05/18 02:48
报这个问题是因为在实体类中定义了有参构造函数,但是忽略了无参构造函数的定义,所以在执行查询的时候会报如下错误:
Caused by: org.apache.ibatis.executor.ExecutorException: No constructor found in com.ris.event.track.model.EventTrack matching [java.lang.Long, java.lang.String, java.lang.Long, java.lang.Long, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.sql.Timestamp, java.sql.Timestamp, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.String, java.lang.String, java.lang.String, java.sql.Timestamp]
比如创造了一个带有参数的构造方法,那么无参的构造方法必须显式的写出来,否则会编译失败"这句话有点不妥,应该这么理解:每个类至少要有一个构造函数,如果你自己构建了一个带有参数的构造函数而没有再显示的写出无参的构造函数也是可以的,不过当你尝试通过一个无参的构造函数来构建(new)时,此时编译器才会报错,因为找不到这个无参的构造函数。也就是说当一个类你没有给他构造函数,则编译器会自动补上一个无参的,若有的话就不会,你需要显示将此无参的构造函数写出来。
所以在创建某个实体类的时候,应该养成一个好习惯,显示构造一个无参构造函数,这样就会避免后面遇到的奇葩问题了。
阅读全文
0 0
- SpringBoot问题之org.apache.ibatis.executor.ExecutorException: No constructor found in...的问题
- org.apache.ibatis.executor.ExecutorException: No constructor found in com.contentsales.meta.User
- 异常org.apache.ibatis.executor.ExecutorException: There was no TypeHandler found for parameter..
- org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the
- MyBatis异常处理org.apache.ibatis.executor.ExecutorException
- org.apache.ibatis.executor.ExecutorException: Cannot get Configuration as configuration factory was
- org.apache.ibatis.executor.ExecutorException: Cannot get Configuration as configuration factory was
- 在写Mybatis时遇到的问题:No constructor found in 包名+类名
- 关于mybatis “org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)” 错误的问题。
- 关于org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):的错误问题
- 关于mybatis “org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)” 错误的问题
- org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'xx'的问题
- ibatis处理器异常(executor.ExecutorException)解决方法
- 【SpringBoot】“没有默认的构造器”,No default constructor found;
- mybatis的org.apache.ibatis.builder.IncompleteElementException问题
- mybatis问题org.apache.ibatis.binding.BindingException: Parameter 'title' not found.
- 无效绑定问题:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
- mybatis问题org.apache.ibatis.binding.BindingException: Parameter 'param' not found.
- Hinton的Capsule论文学习
- 知道这些,你的世界会变得不一样
- msf学习笔记(4)
- 使用IDEA2017创建java web +maven项目
- 【Source Insight】基本使用和快捷键
- SpringBoot问题之org.apache.ibatis.executor.ExecutorException: No constructor found in...的问题
- MYSQL 常用问题处理命令与常用命令 不能连接问题
- Java基础
- Hibernate的配置以及操作
- go环境搭建和资料推荐(转载)
- java IO 之 标准键盘输入
- Home Robber II
- spring-boot-web-ui及thymeleaf基本使用
- Servlet域对象和会话技术原理