Reputation: 4045
I've got a sql data type of TIME. Now, the data for 12:00 AM is stored as 00:00:00.
In the POJO that is mapped to the table, I have given the datatype as java.util.Date as per the hibernate specification. However, on loading a row that has the data type 00:00:00 i get this exception.
Cannot convert value '00:00:00' from column 18 to TIMESTAMP
How do I solve this?
Upvotes: 0
Views: 2395
Reputation: 1511
For SQLServer you can use something like this. It should also work for time types I guess.(I don't know if it changes for other DB types)
private Date lockedUntil;
@Column(name="DATE", columnDefinition="DATETIME")
@Temporal(TemporalType.TIMESTAMP)
public Date getDate() {
return date;
}
Upvotes: 1