Tuesday, December 21, 2004

MySQL Hibernate and Timestamp issues

Long day trying to figure out a problem with passing a null value on a
Hibernate object that corresponds to a Timestamp field in MySQL. You
can't do it because MySQL interprets the null to mean "insert current
time", and so it does. But, in your sql statement you can place '' and
the column will remain null. After looking through the forums the
general suggestion is the DateTime type to get around this issue.
Because we'll be using Oracle in production anyway (both types map to
Date) this is a moot point--we need to update all of our Timestamps to
DateTime and manually set the values per record.

No comments: