tags:

views:

113

answers:

2

I have the following in one of my result mappings.

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

basically updateDate is a setter that accepts Date. However, sometimes updateDate will be null in the database. In those cases I want to have a default date of 01/01/1900.

However, the above mappings gives me the following error when updateDate is null from DB

Cause: java.lang.RuntimeException: Error setting property 'setUpdateDate'
A: 

Is the problem that your nullValue="01/01/1900" is trying to pass a string into updateDate setter? If you took that out, I assume the setter would be called by iBatis with 'null' and then you could apply the default in your setter in the Java code.

Pete
A: 

Can you change your updateDate method to take a null and set the "01/01/1900" Date in there?

This message can also occur when the setter doesn't exist or is spelled incorrectly too, make sure that's not the case.

MattGrommes