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;