0

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'

1
  • 1
    No idea about Java but if you remove that last three digits, you get the Unix timestamp for today: 1364212575 => Mon, 25 Mar 2013 11:56:15 GMT. Commented Mar 25, 2013 at 12:10

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.