Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='roomId', mode=IN, javaType=class java.lang.Long, jdbcType=VARCHAR, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType VARCHAR . 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.Long


这个问题是因为parameterType="java.lang.String"的参数与实体类的参数类型不一致造成的,另外jdbcType=VARCHAR也需要与数据库表列的类型一致

posted on 2022-06-18 19:39  bug鸭~  阅读(3983)  评论(0编辑  收藏  举报