mybatis使用selectByPrimaryKey出错

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

猜你喜欢

转载自blog.51cto.com/xuguohongai/2308981