IllegalArgumentException:argument type mismatch

Scroll Down

Exception

nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property 'id' of 'class com.wzq.test.demo.entity.Fee' with value '1211518556674199553'Cause:java.lang.IllegalArgumentException: argument type mismatch

场景:

添加不传ID使用数据库中的自增。提示类型转换错误,Long转换Integer错误,原因ID初始化值过大转化成Integer错误。

解决:

设置ID的初始化值:ALTER TABLE TABLENAME AUTO_INCREMENT=1;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;