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

在这里插入图片描述

解决办法:

在do类的id字段上加 @TableId 注解设置type = IdType.AUTO来指定id自增长,问题解决。
在这里插入图片描述

发布了34 篇原创文章 · 获赞 3 · 访问量 980

猜你喜欢

转载自blog.csdn.net/qq_41870790/article/details/103100715
今日推荐