ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Maves <Nathan.Ma...@Sun.COM>
Subject Better Solution for null properties
Date Fri, 11 Feb 2005 21:23:18 GMT
Is there a better way for dealing with null attributes?

Currently I have to do something like..

<insert id="insertA">
	insert into A (
		id
		<isNotNull prepend="," property="name">
		name
		</isNotNull>
	) values (
		#id#
		<isNotNull prepend="," property="name">
		#name#
		</isNotNull>
	)
</insert>

or

<insert id="insertA">
	insert into A (
		id,
		name
	) values (
		#id#
		<isNotNull prepend="," property="name">
		#name#
		</isNotNull>
		<isNull prepend="," property="name">
		null
		</isNotNull>
	)
</insert>

This become very tedious when you have 10+ columns that might be null.  
Why does this happen with Oracle?  Is there anyway that iBatis could 
check if the property was null and if so call the setNull() of a 
prepared statement?  I am sure that I am over simplifying the process 
but just thought I would throw it out there.

Nathan


Mime
View raw message