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:35:29 GMT
I've tried doing it inline and i still get the database error, cannot
insert null value.
I'm trying to insert -1 and not a  null value because the database
column is set to not null.

________________________________

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


BTW you could also do it inline 


insert into A (col1,col2) values (#col1:NUMERIC:-1#,
#col2:VARCHAR:NO_ENTRY#


This can be found on page 20 of the developers guide

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