org.apache.ibatis.executor.ExecutorException: No constructor found in com.contentsales.meta.User
2017-02-13 16:24
645 查看
今天在弄mybatis的时候,出现下面这个错误:
我的User类代码如下:
看报错信息是说没有找到符合的构造函数,它需要
1. 将这个构造函数的
2. 不改的话,就在代码中再加上一个默认的构造函数,即添加
原因还有待探究。。。
Exception in thread "main" org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: No constructor found in com.contentsales.meta.User matching [java.lang.Integer, java.lang.String, java.lang.String, java.lang.Integer]
我的User类代码如下:
public class User { private int id; private String name; private String password; private int type; public User(int id,String name,String password,int type){ this.id=id; this.name=name; this.password=password; this.type=type; }
看报错信息是说没有找到符合的构造函数,它需要
[java.lang.Integer, java.lang.String, java.lang.String, java.lang.Integer],也就是说原始类型
int和对象类型
Integer是需要区分的,使用下面两种方案就可以解决:
1. 将这个构造函数的
int原始类型改成
Integer,即改成
public User(Integer id,String name,String password,Integer type)
2. 不改的话,就在代码中再加上一个默认的构造函数,即添加
public User(){ }
原因还有待探究。。。
相关文章推荐
- SpringBoot问题之org.apache.ibatis.executor.ExecutorException: No constructor found in...的问题
- MyBatis Error:org.apache.ibatis.executor.ExecutorException: No constructor found in pojo
- 异常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
- org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the
- org.apache.ibatis.reflection.ReflectionException:There is no getter for property named 'parentId' in
- org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.szh.bean.product
- org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.mplus.server.dat
- 【spring boot Mybatis】报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.newhope.interview.dao.UserMapper.add
- org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'userIds' in
- org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map com.vo.app
- com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.apache.ibati
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.png.mapper.User
- org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'id' in 'cla
- Exception in thread "main" org.apache.ibatis.binding.BindingException: Mapper method 'com.demo.DAO.B
- Exception in thread "main" org.hibernate.MappingNotFoundException: resource: com.xzhl.user.model/Stu
- org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map com.hyzn.historicalRecord.dao.ITB_HISTORYLOGDAO.TB_HISTORYLOGResultMap
- org.apache.ibatis.binding.BindingException: Type interface dxm.com.mapper.UserMapper is not known to
- org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'funcSetId' in 'class java.lang.Integer'
- org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'agoTime' in