You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Bhaarat Sharma <bh...@gmail.com> on 2010/02/11 21:24:11 UTC

what to put in nullValue when date value is null

I have following in my result mapping:

<result property="updateDate" column="update_date" javaType="java.sql.Date"
jdbcType="DATE" nullValue="01/01/1900"/>

setUpdateDate is accepting parameter of type Date
update_date column can sometimes be null. In this case I want the date to be
01/01/1900.

It is giving me an error: java.lang.RuntimeException: Error setting property
'setUpdateDate'

What is the way to put nullValue for a date field?

RE: what to put in nullValue when date value is null

Posted by Niels Beekman <n....@wis.nl>.
Use a type handler. Better even, do not use nullValue at all and handle
this case in your domain logic. 1900 sounds like a magic value to me.

 

Niels

________________________________

From: Bhaarat Sharma [mailto:bhaarat.s@gmail.com] 
Sent: Thursday, February 11, 2010 9:24 PM
To: user-java@ibatis.apache.org
Subject: what to put in nullValue when date value is null

 

I have following in my result mapping:

 

<result property="updateDate" column="update_date"
javaType="java.sql.Date" jdbcType="DATE" nullValue="01/01/1900"/>

 

setUpdateDate is accepting parameter of type Date

update_date column can sometimes be null. In this case I want the date
to be 01/01/1900. 

 

It is giving me an error: java.lang.RuntimeException: Error setting
property 'setUpdateDate'

 

What is the way to put nullValue for a date field?