zoukankan      html  css  js  c++  java
  • 报错信息是Error setting null for parameter #1 with JdbcType OTHER

    报错信息是:nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='__frch_item_0.userId', mode=IN, javaType=class java.lang.Long, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting null for parameter #1 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 无效的列类型: 1111

    报错原因是:传过来的参数类型不对,需要的是一个long型的数据,结果传过来是一个String类型的数据,导致接收不了,网上说在传过来的数据jdbcType=NUMERIC,如下,数据库里number类型的数据写成NUMERIC,发现换了一个错,但是仍然没有解决

    <insert id="batchUserRole" useGeneratedKeys="false">
    insert all
    <foreach item="item" index="index" collection="list">
    into sys_user_role(user_id, role_id) values (#{item.userId,jdbcType=NUMERIC},#{item.roleId,jdbcType=NUMERIC}
    </foreach>
    SELECT 1 FROM DUAL
    </insert>

    解决办法是:检查前端部分传过来的数据是否正确

  • 相关阅读:
    简单的股票分析系统
    gtest日志在工程项目中的应用
    doctest初次体验
    python写的读取json配置文件
    logbook日志系统
    python3 pyodbc简单使用
    numpy中dtype
    python获取代码行号
    Python操作SQLServer示例(转)
    log4j与log4j.properties的配置
  • 原文地址:https://www.cnblogs.com/zzxzxn/p/10761645.html
Copyright © 2011-2022 走看看