How can I map a Java date to DATETIME in mysql (by default its TIMESTAMP) with Hibernate annotations

Use the columnDefinition attribute of the @Column annotation:

@Column(name = "startTime", columnDefinition="DATETIME")
@Temporal(TemporalType.TIMESTAMP)
private Date startTime;

And please, make your attributes private.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)