How to work with NULL-Values in DateTime-Types using persistence?
We are facing the following problem: We are using the persistence-feature to handle complex objects. During the fetch we get values where a datetime-field is not set (NULL in the database) - when we try to write the entity object instance back to the database (merge) we get the following exception:
"SQLException: Only dates between January 1, 1753 and December 31, 9999 are accepted.
DataException: could not update: [de.*****.qia.persistence.QuestionnaireQuestion#130]
PersistenceException: org.hibernate.exception.DataException: could not update: [de.*****.qia.persistence.QuestionnaireQuestion#130]
RollbackException: Error while committing the transaction
Failed to excecute operation "merge" for persistence unit "qiaPersistence".
The reason is quite obvious - the auto-initialized value is out of the allowed range for the MSSQL-Server. But shouldn't NULL be the value to be written back?
How can we adress this? A workaround would be to enforce that a date is created during the initial persist but there could be situation where "NULL" is programmtically a valid entry.
How can we adress this issue?issue?
Edit:
RDBMS: MSSQL Express 2008