其他分享
首页 > 其他分享> > Try setting a different JdbcType for this parameter or a different configuration property. mybatis查询

Try setting a different JdbcType for this parameter or a different configuration property. mybatis查询

作者:互联网

 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也需要与数据库表列的类型一致

标签:lang,different,property,java,Try,setting,VARCHAR,null
来源: https://www.cnblogs.com/yangj2280539387/p/16389080.html