Mybatis报错:Error instantiating class comr…with invalid types ()or values()Cause: java.lang.IllegalArgumentException: argument type mismatch
报错:Error instantiating class com.nowcoder.community.entity.User with invalid types (int,String,String,String,String,int,int,String,String,Data) or values (101,liubei,390ba5f6b5f18dd4c63d7cda170a0c74,12345,nowcoder101@sina.com,0,1,null,http://images.nowcoder.com/head/100t.png,2019-04-03 12:04:55.0). Cause: java.lang.IllegalArgumentException: argument type mismatch
原因是:在User实体类中添加了有参数的构造器,但是没有加无参的,去掉有参构造器或者在加上无参的构造器就好了,原来有参构造器的传值列表跟mabits返回的参数列表不对应,也经此发现原来mabits映射的字段是由构造器放进映射类的
private String username;
private String password;
/*yan*/
private String salt;
private String email;
/**/
private int type;
/*状态*/
private int status;
/*激活码*/
private String activationCode;
private String headerUrl;
private Data createTime;
public User(int id, String username, String password, String salt, String email, int type, int status, String activationCode, String headerUrl, Data createTime) {
this.id = id;
this.username = username;
this.password = password;
this.salt = salt;
this.email = email;
this.type = type;
this.status = status;
this.activationCode = activationCode;
this.headerUrl = headerUrl;
this.createTime = createTime;
}