栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

【错误】org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeExcept

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

【错误】org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeExcept

背景:

        spring+mybatis-plus

错误:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='mybatis_plus_first', mode=IN, javaType=long, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #4 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 (4 > number of parameters, which is 3).
原因:

mapper.xml注释不规范

1.注释中带有#{}占位符,但mybatis仍旧会把#{}算成一个带注入的参数;

2.在动态sql语句前后或中间使用了 -- 注释符号,导致mybatis认为参数缺失。

 建议:

 1.xml 的 sql 语句标签中,建议使用 ctrl+shift+/ 生成 样式的注释;

2.xml 的文件内应使用 样式的注释,不能使用 样式的注释;

3.若想加中文注释应使用 头。

ps:代码不规范,测试两行泪ヽ(ー_ー)ノ

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/737645.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号