Could not set property 'id' of 'class XX' with value 'XX' argument type mismatch 解决办法

我是用的是:

idea 2018 mysql 5.5 mybatis-plus

报错:

注意加粗部分

2019-11-16 16:53:29.651 ERROR 24132 — [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property ‘id’ of ‘class com.item.DO.ClassRoomDo’ with value ‘1195625928345116673’ Cause: java.lang.IllegalArgumentException: argument type mismatch] with root cause

错误分析:

错误提示为没有设置 id 属性 id自增长没问题 那么可能是往数据库插的do类mybatis-plus没有为其设置自增的id

Could not set property 'id' of 'class XX' with value 'XX' argument type mismatch 解决办法_第1张图片

解决办法:

在do类的id字段上加 @TableId 注解设置type = IdType.AUTO来指定id自增长,问题解决。
Could not set property 'id' of 'class XX' with value 'XX' argument type mismatch 解决办法_第2张图片

你可能感兴趣的:(JAVA)