mybatis参数类型不匹配错误argument type mismatch

错误日志

java.lang.RuntimeException: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: Error selecting key or setting result to parameter object. Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property ‘id’ of ‘class xxxxxxxx’ with value ‘37997’ Cause: java.lang.IllegalArgumentException: argument type mismatch
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: Error selecting key or setting result to parameter object. Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property ‘id’ of ‘class com.fshows.lifecircle.marketcore.service.dal.lifecircle.dataobject.TpLifecircleQuotaDO’ with value ‘37997’ Cause: java.lang.IllegalArgumentException: argument type mismatch

错误描述

根据字面意思就是:参数类型不匹配

实际就是某个参数存储的,与传入的参数类型不一致

错误代码

mybatis参数类型不匹配错误argument type mismatch_第1张图片

错误原因

在mybatis:gen生成代码的时候,这个id参数生成类型resultType=“java.lang.Long”,但实际数据库类型是int,应该对应resultType=“java.lang.Integer”

只要将Long改为Integer,与数据库对应即可。

你可能感兴趣的:(java,mybatis,java)