mybatis-plus插入数据时,关于id没有赋值,系统自动赋值,并报错Could not set property ‘id‘ of ‘***‘ with value

时间:2025-04-16 09:13:43

然后开始inset,随便写个伪代码

User user = new User();
user.setId("");
user.setName("测试");
this.insert(user);

然后就报错了,一看报错信息是
: nested exception is :
Could not set property ‘id’ of 'class User ’ with value ‘1278867511785242626’
Cause: : argument type mismatch

what??
我并没有设置id啊,看着这有规则数字,很像是mybatis-plus自动生成的主键值