java.lang.IllegalArgumentException: argument type mismatch【@TableId】

Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: 
nested exception is org.apache.ibatis.reflection.ReflectionException:
Could not set property 'userId' of 'class com.xdx.entitys.pojo.SyUser' with value '1266635804901814274' 
Cause: java.lang.IllegalArgumentException: argument type mismatch] with root cause

這個異常就是一個參數類型不匹配的問題,比如你的數據庫是int,但是你插入的是String,所以按照這個思路去解決就好了。




但是我怎麼修改類型都是不對,我使用到了MyBatisPlus 裏面的 @TableId 註解,一般我加上都沒什麼問題。但是我這次主鍵使用的是自增長,那麼應該這樣寫。

/**
 * 用戶id
 */
@TableId(value = "user_id",type = IdType.AUTO)
private Integer userId;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章