mybatis 插入null 时需要指定jdbcType

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

	<insert id="insertInstrument" parameterType="com.labway.oa.po.Instruments">
		insert into
		instruments
		(group_name,
		name,
		description,
		on_line,
		operator,
		x_sbxh,
		serial_no,
		x_lc,
		x_sbjd,
		vendor,
		<!-- x_sbsx, -->
		location,
		changed_on,
		changed_by,
		removed,
		low_threshold,
		high_threshold,
		stability_delta,
		stability_number,
		port_number,
		discard_time,
		size_limit,
		time_out,
		polling_time,
		needs_calibration,
		needs_pm,
		holds_samples,
		include_subdirs,
		debug,
		store_in_db_file,
		db_file_prompt,
		x_jlsx,
		x_funcheck_status,
		x_timecheck_status,
		x_name,
		x_description,
		x_funcheck_date,
		x_timecheck_date,
		pm_date,
		x_pm_status,
		x_status,
		x_group_name
	

		) values(
		#{group_name,jdbcType=VARCHAR},
		#{name,jdbcType=VARCHAR},
		#{description,jdbcType=VARCHAR},
		#{on_line,jdbcType=VARCHAR},
		#{operator,jdbcType=VARCHAR},
		#{x_sbxh,jdbcType=VARCHAR},
		#{serial_no,jdbcType=VARCHAR},
		#{x_lc,jdbcType=VARCHAR},
		#{x_sbjd,jdbcType=VARCHAR},
		#{vendor,jdbcType=VARCHAR},
		<!-- #{x_sbsx}, -->
		#{location,jdbcType=VARCHAR},
		#{changed_on,javaType=String,jdbcType=DATE,typeHandler=com.labway.portal.handler.LwDateTypeHandler},
		#{changed_by,jdbcType=VARCHAR},
		‘F‘,
		‘0‘,
		‘0‘,
		‘0‘,
		‘0‘,
		‘0‘,
		‘0‘,
		‘0‘,
		‘0‘,
		‘0‘,
		‘F‘,
		‘F‘,
		‘F‘,
		‘F‘,
		‘F‘,
		‘F‘,
		‘F‘,
		‘T‘,
		‘F‘,
		‘F‘,
		#{name,jdbcType=VARCHAR},
		#{description,jdbcType=VARCHAR},
		#{x_funcheck_date,javaType=String,jdbcType=DATE,typeHandler=com.labway.portal.handler.LwDateTypeHandler},
		#{x_timecheck_date,javaType=String,jdbcType=DATE,typeHandler=com.labway.portal.handler.LwDateTypeHandler},
		#{pm_date,javaType=String,jdbcType=DATE,typeHandler=com.labway.portal.handler.LwDateTypeHandler},
		#{x_pm_status,jdbcType=VARCHAR},
		#{x_status,jdbcType=VARCHAR},
		#{x_group_name,jdbcType=VARCHAR}
		)
	</insert>


本文出自 “大话程序” 博客,请务必保留此出处http://houqida.blog.51cto.com/8877896/1584685

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。