zoukankan      html  css  js  c++  java
  • mybatis插入语句空值没有设置jdbcType报错

    Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException: Error setting null for parameter #6 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 无效的列类型: 1111 
    ; uncategorized SQLException for SQL []; SQL state [99999]; error code [17004]; 无效的列类型: 1111; nested exception is java.sql.SQLException: 无效的列类型: 1111 

    需要在插入语句中设置jdbcType

    如下

    <insert id="insertCustomerLog1" parameterType="com.diyicai.customer.domain.CustomerLog">  
            insert into customer_log  
                   (  
                   ID,  
                   CUSTOMER_SERVICE_USER_NAME,  
                   user_name ,  
                   CONTENT,  
                   LOG_FIRST_TYPE,  
                   STATUS,  
                   LINKED_ID,  
                   FEE,  
                   ACCOUNT_FIRST_TYPE,  
                   ACCOUNT_SECOND_TYPE,  
                   ACCOUNT_THIRD_TYPE,  
                   LOG_SECOND_TYPE,  
                   LOG_IP,  
                   MEMO  
                   )  
                   values  
                   (  
                   seq_customer_log.nextval ,  
                   #{customerServiceUserName,jdbcType=VARCHAR} ,  
                   #{username,jdbcType=VARCHAR},  
                   #{content,jdbcType=VARCHAR},  
                   #{logFirstType,jdbcType=NUMERIC},  
                   #{status,jdbcType=NUMERIC},  
                   #{linkedId,jdbcType=VARCHAR},  
                   #{fee,jdbcType=NUMERIC},  
                   #{accountFirstType,jdbcType=NUMERIC},  
                   #{accountSecondType,jdbcType=NUMERIC},  
                   #{accountThirdType,jdbcType=NUMERIC},  
                   #{logSecondType,jdbcType=NUMERIC},  
                   #{logIp,jdbcType=VARCHAR},  
                   #{memo,jdbcType=VARCHAR}  
                   )  
        </insert>  

    参考: http://makemyownlife.iteye.com/blog/1610021

  • 相关阅读:
    jq随手写图片放大
    solr查询语句示例
    solr使用语法笔记
    PHP的输出缓冲区(转)
    利用fsockopen可实现异步成功访问
    mysql自动加入添加时间列
    MySQL性能分析及explain的使用
    VS 无法启动程序
    android 编写动画
    Advanced Installer
  • 原文地址:https://www.cnblogs.com/dashuai01/p/9509914.html
Copyright © 2011-2022 走看看