MyBatis Why to set Jdbctype

Source: Internet
Author: User

I have not noticed this problem before, and I never set the Jdbctype with Ibatis. Ibatis also does not appear to be the problem. Study the

——————————————————————————————————————————————

Reprinted from: http://makemyownlife.iteye.com/blog/1610021

Encountered a problem the day before yesterday the exception appears as follows: reference
Exception in thread ' main ' org.springframework.jdbc.UncategorizedSQLException:Error setting null for parameter #6 with Jd Bctype other. Try setting a different jdbctype for this parameter or a different jdbctypefornull the configuration property. Cause:java.sql.SQLException: Invalid column type: 1111
; Uncategorized SQLException for SQL []; SQL state [99999]; Error code [17004]; Invalid column type: 1111; Nested exception is java.sql.SQLException: Invalid column type: 1111


The corresponding sqlmap are as follows:
XML code    <insert id= "Insertcustomerlog"  parametertype= "map" >          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} ,                #{username},               #{ content},               #{logfirsttype},                #{status},               #{linkedId},                #{fee},                #{accountFirstType},                #{accountSecondType},                #{accountThirdType},                #{logSecondType},                #{logIp},               #{memo}          )      </insert>  

Some information has been queried to say:

Reference
MyBatis you want to insert a null value, you need to specify Jdbctype
MyBatis insert NULL returns an empty value exception, but PL/SQL does not prompt for errors, mainly because MyBatis cannot be converted.


So change the XML to:
XML code    <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},               &NBSP;&NBSP;&NBSP;&NBSP;#{LOGIP,jdbctype=varchar},         

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.