Hi,
Is there any way to set a default SYSDATE on a column ? INSERT INTO table (dateCreation, ...) VALUES (SYSDATE(),...) I'm using hibernate 3.5.7 (with annotations) with mysql 5.1.37 My tables all have two date fields : dateUpdate and dateCreation
dateUpdate is managed by the database. Mysql allows only one column with default time, therefore dateCreation cannot have default in the DB.
We want the database date not the webserver date, so we cannot set the date in java. We also cannot use any triggers/procedures to set the value on insert. We want to use annotations rather than xml config if possible
The following solution would be ideal but doesn't work : @Column(name="STATUS_DATE",columnDefinition = "Date default SYSDATE" ) public Date getStatusDate() { return statusDate; }
Other proposed solutions are not possible for us and not good enough anyway. I had a look everywhere, including on JIRA and this forum and it's unclear if something is going to change and when.
Does anyone have a solution or some information ?
Thanks
|