mybatis使用selectByPrimaryKey出错

2023-06-02,,

mybatis使用selectByPrimaryKey查询时需要主键是String类型的,因此需要将表对应的实体类中的类型改成String不能为其它类型

nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='id', mode=IN, javaType=class java.lang.Integer, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer

《mybatis使用selectByPrimaryKey出错.doc》

下载本文的Word格式文档,以方便收藏与打印。