Reputation: 497
Please see below the coding, mapping and MySQL existing column of a table. I am just getting an err
User.Java
private Date time = null;
public Date getTime() {
time = new Date();
return time;
}
In hibernate mapping file
<property name="time" type="date" column="time"/>
MySQL table's column
time (DATETIME)
Error: Data truncation: Incorrect datetime value: '1364212575328' for column 'time'
Upvotes: 0
Views: 88
Reputation: 2596
You can use the following configuration :
<property name="time" type="java.util.Date">
<column name="time" sql-type="datetime" />
</property>
This should do the trick.
Upvotes: 1