I am trying to generate current date automatically but getting this error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near 'CURRENT_DATE' at line 1
@Column(name = "ddate", columnDefinition = "DATE DEFAULT CURRENT_DATE")
private Date ddate;
CodePudding user response:
I would recommend trying the CreationTimestamp annotation paired with nullable = false, updatable = false
@Column(name = "ddate", nullable = false, updatable = false)
@CreationTimestamp
private Date ddate;
The above strategy uses the current VM date, so use this if you are ok with that.