Incorrect timestamp value
Posted by: Glenn Puckett
Date: May 22, 2013 12:06PM

I have an application that's been in production several years. In various places I use Timestamp to record when various actions take place. This is more than just when a certain record is added or updated. Up to now I haven't had a bit of a problem with Timestamp. This week I started getting failures at any record that includes a Timestamp.

The error I am getting is:

[JDBCExceptionReporter] Data truncation: Incorrect timestamp value: '' for column 'last_labor_rpt_date' at row 1

Of course the column name can change but the results are the same. Currently on the database table the Timestamp field is saved as "YYYY-MM-DD HH:MM:SS". I am assuming from what I can see during debugging that for some reason Hibernate is now trying to include the decimal part of seconds, which for my purposes are totally unnecessary. I have tried requesting that Hibernate show the SQL at the insert/update. I get the SQL with the ? fields but I can't get it to show the actual data being inserted. So I can't be totally sure.

My log4j entries are:

<logger name="org.hibernate">
<level value="DEBUG" />
<appender-ref ref="CONSOLE"/>
</logger>

<logger name="org.hibernate.type">
<level value="TRACE" />
<appender-ref ref="CONSOLE"/>
</logger>

In the persistence.xml file I have:

<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="use_sql_comments" value="true"/>

My application is using Hibernate 3.3 with annotations. It is running on JBoss 4.3 and using MySQL 5.5.

The original code is:

private Timestamp lastLaborRptDate;
@Column(name = "last_labor_rpt_date", length=19)
public Timestamp getLastLaborRptDate() {
return this.lastLaborRptDate;
}
public void setLastLaborRptDate(Timestamp lastLaborRptDate) {
this.lastLaborRptDate = lastLaborRptDate;
}

It is still running fine on my production server. However, on my development server which basically duplicates the production environment, I am now getting these failures. This includes areas of the application that have been untouched.

I have tried several different things based on results of Google searches. Including changing the database field to DateTime with the same results.

I am stuck. How do I get past this?

Options: ReplyQuote


Subject
Written By
Posted
Incorrect timestamp value
May 22, 2013 12:06PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.