MyBatis 通过包含的jdbcType类型

BIT         FLOAT      CHAR           TIMESTAMP       OTHER       UNDEFINED

TINYINT     REAL       VARCHAR        BINARY          BLOB        NVARCHAR

SMALLINT    DOUBLE     LONGVARCHAR    VARBINARY       CLOB        NCHAR

INTEGER     NUMERIC    DATE           LONGVARBINARY   BOOLEAN     NCLOB

BIGINT      DECIMAL    TIME           NULL            CURSOR

MyBatis 插入空值时,需要指定JdbcType
mybatis insert空值报空值异常,但是在pl/sql不会提示错误,主要原因是mybatis无法进行转换,

<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>


你可能感兴趣的:(mybatis)