Could not set property 'id' of XXX with value 'd5df7e51ef743dc634a43edb962bd62c'

在某张表中设置了该表的id自增,在插入一条数据的时候,并没有对id进行赋值,可是报错如下:

org.mybatis.spring.MyBatisSystemException: 
nested exception is org.apache.ibatis.reflection.ReflectionException: 
Could not set property 'id' of 'classorg.jeecg.modules.interfaces.entity.InterfaceTypeEntity' 
with value 'd5df7e51ef743dc634a43edb962bd62c'
Cause: java.lang.IllegalArgumentException: java.lang.ClassCastException@547f813nested exception is org.apache.ibatis.reflection.

我在查资料的时候发现了一个大佬的解决方法:大佬解决方法链接
在实体类的id字段字段上加上@TableId(type = IdType.AUTO)就可以解决这个问题了

猜你喜欢

转载自blog.csdn.net/weixin_39040527/article/details/105944510