环境:springboot2.3.1+mybatis plus3.3.2

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property 'id' of 'class com.mxx.homekeeper.usermanage.entity.HkUserInfo' with value '1277617954032193538' Cause: java.lang.IllegalArgumentException: argument type mismatch

 

【解决方案】

在实体类的主键id上增加一个注解 @TableId(type = IdType.AUTO)

 

其他type类型介绍

    AUTO : AUTO(0, “数据库ID自增”),
    INPUT : INPUT(1, “用户输入ID”),
    ID_WORKER : ID_WORKER(2, “全局唯一ID”),
    UUID : UUID(3, “全局唯一ID”),
    NONE : NONE(4, “该类型为未设置主键类型”),
    ID_WORKER_STR : ID_WORKER_STR(5, “字符串全局唯一ID”);

相关文章:

  • 2021-12-16
  • 2022-12-23
  • 2021-08-05
  • 2021-09-15
  • 2021-07-27
  • 2021-10-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
  • 2021-11-04
相关资源
相似解决方案