I\'m working on some project which needs to extract data from DB and I use Spring MVC to build model from DB for selecting data.
Here is the problem with my
In MySql '0000-00-00' is considered a valid date, but it can't be repesented as java.sql.Date.
You could use a query that returns NULL in case date is '0000-00-00', or the actual value otherwise:
SELECT
CASE WHEN `date`!='0000-00-00' THEN `date` END new_date
FROM
yourtable
or you can add to your datasource connection string this:
zeroDateTimeBehavior=convertToNull
and dates as '0000-00-00' will be automatically converted to NULL.