springboot 数据库新增值 Could not set property 'id' of '.... +【argument type mismatch】

2022/3/9 19:14:46

本文主要是介绍springboot 数据库新增值 Could not set property 'id' of '.... +【argument type mismatch】,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

 

用mybatispluc往数据库新增值一直提示 Could not set property 'id' of ' “xxxxxxxxxxxxxxx”

并且报argument type mismatch错误  参数类型不匹配

 

原因是数据库主键自动自增  和 mybatisplus自动递增方式不同

mybatisplus默认帮我设置为雪花算法生成主键id  是长串类型 xxxxxxxxxxxxxxx

 

解决方法:

实体类自己加上主键自增类型,不要用mybatisplus默认的

    @TableId(type = IdType.AUTO)
    Integer id;//主键id

设置成这个就是自己数据库默认的递增方式了。

 



这篇关于springboot 数据库新增值 Could not set property 'id' of '.... +【argument type mismatch】的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程