【Mybatis报错:Error instantiating class comr...with invalid types ()or values()Cause: java.lang.Illega】

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;
    }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值