org.apache.ibatis.type.TypeException: Error setting non null for parameter #3 with JdbcType null

  • Post author:
  • Post category:其他


错误描述:

org.mybatis.spring.MyBatisSystemException: 
nested exception is org.apache.ibatis.type.TypeException: 
Could not set parameters for mapping: 
ParameterMapping{.............}. 
Cause: org.apache.ibatis.type.TypeException: 
Error setting non null for parameter #3 with JdbcType NUMERIC . 
Try setting a different JdbcType for this parameter or a different configuration property. 
Cause: org.apache.ibatis.type.TypeException: 
Error setting non null for parameter #3 with JdbcType NUMERIC . 
Try setting a different JdbcType for this parameter or a different configuration property. 
Cause: java.sql.SQLException: 无效的列索引

发现问题:

控制台中打印的sql语句,【– (?,?, – ‘0’,sysdate,sysdate) 】这个部分明显是错误的

Preparing: insert into PROJECT_MEMBER(PROJECT_ID,MEMBER_ID,DELETED,CREATE_TIME,MODIFY_TIME) values ( select ? ? "0" sysdate sysdate from dual ) item -- (?,?, -- '0',sysdate,sysdate) 

原因:

在xml文件中包含了注释

    <insert id="insert">
        ......
        ......
--                (#{projectId,jdbcType=NUMERIC},#{attachmentId,jdbcType=NUMERIC},
--                 '0',sysdate,sysdate)
    </insert>



版权声明:本文为lwd18175239125原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。