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 Re: Inserting Default values if object member is null
Date Mon, 14 Nov 2005 19:29:25 GMT
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