ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Hall" <JH...@cihi.ca>
Subject RE: Inserting Default values if object member is null
Date Mon, 14 Nov 2005 19:25:49 GMT
I tried using null property and i get and sqlmapconfig parsing error -
"null" not a valid property.
 
<parameterMap id="paramMap" class="Dummy" >
  <parameter property="id"  jdbcType="NUMERIC" null ="-999"/>
  <parameter property="name" jdbcType="VARCHAR" />
  <parameter property="flag" jdbcType="NUMERIC" />
  <parameter property="ndate" jdbcType="DATE" />
</parameterMap>
 

________________________________

From: Nathan.Maves@Sun.COM [mailto:Nathan.Maves@Sun.COM] 
Sent: Monday, November 14, 2005 2:24 PM
To: user-java@ibatis.apache.org
Subject: Re: Inserting Default values if object member is null


Whoops.... wrong attribute. 

You need to use null="" and not nullValue.

This should substitute the given value for any property that is null.

Nathan

On Nov 14, 2005, at 12:09 PM, Jason Hall wrote:


	Yah, but the db column is set to not null, so you would get a
database error.
	I've tried that anyhow, and got that not null error.  I believe
the nullValue is used for a replacement to insert a null value not to
define a default in the
	event the object property is null.
	 
	thx:)
	 

________________________________

	From: Nathan.Maves@Sun.COM [mailto:Nathan.Maves@Sun.COM] 
	Sent: Monday, November 14, 2005 2:05 PM
	To: user-java@ibatis.apache.org
	Subject: Re: Inserting Default values if object member is null
	
	
	You can specify your insert sqlmap to use a ParameterMap and set
the nullValue property on the specific column. 

	Nathan

	On Nov 14, 2005, at 11:16 AM, Jason Hall wrote:


		Hi,
		 
		I just want to know if an object member is set to null
and the database column is configured as not null, 
		is there a way in the sqlmapconfig.xml to set a default
value say -1 in a parameter map.
		I've used nullValue but this is not exactly what i want.
I need a default value like a database default.
		 
		Thanks,
		 
		JH.
		 




Mime
View raw message