mybatis plus中添加数据报错"nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property 'id' of 'class com.soso.eduservice.domain.EduTeacher' with value '1444921964545253378' Cause: java.lang.IllegalArgumentException: argument type mismatch",
前言
最近练习尚硅谷的谷粒学院项目时候 在后台添加讲师模块时候出现如上错误,
以下是我的问题详细描述和解决办法
一、问题背景描述?
数据库使用的char类型的表示字段 id,和实体类使用的 string类型 问题不大 ,后面插入时候显示的如上错误
二、解决方法
错误位置![错误位置](https://img-blog.csdnimg.cn/2c962acec49249258ff6eed49e607530.png)
正确做法:
自动填充中 一个是自动生成int类型 和type = IdType.ID_WORKER_STR 自动生成 string类型的唯一id
总结
类型错误 导致插入失败!!!