问题:在mapper.xml文件中插入数据,报错如下:
There was an unexpected error (type=Internal Server Error, status=500).
nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='Sno', mode=IN, javaType=class java.lang.String, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #6 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Parameter index out of range (6 > number of parameters, which is 5).
mapper.xml文件代码:
试了网上的解决办法:
org.apache.ibatis.type.TypeException
https://www.cnblogs.com/zhangcheng1/p/11277441.html
都没用,最后偶然发现是mapper.xml文件注释的原因,把注释去掉之后就可以了。
参考:nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: