- This topic has 2 replies, 2 voices, and was last updated 16 years, 4 months ago by Douglas M Hurst.
-
AuthorPosts
-
Douglas M HurstParticipantI’m not sure if I should be reporting this as a bug or not.
I’m trying to update a MySQL DATETIME field after some computations
dReturn = Mon Jun 30 16:28:59 EDT 2008
String dReturn = mySched.getLastRun().toString();
switch(mySched.getScheduleId()) {
case 1: DatabaseCount(); break;
case 2: DatabaseContent(); break;
case 3: FileCount(saSizeDirectory); break;
case 4: FileContent(saContentDirectory); break;
default: System.out.println(“No reports to run”);
}
TransactionStatus status = txManager
.getTransaction(new DefaultTransactionDefinition());
dao.update(mySched);
txManager.commit(status);So, at the time of update mySched.getLastRun() has a full date time in it, but when I update the MySQL database, the time is going in as…
2008-06-30 00:00:00
… updated to the correct yyyy-mm-dd, but the time is always 00:00:00
Is the a dao bug? A MySQL bug? Am I doing something wrong? My setter/getter as generated by the reverse engineering is
@Temporal(TemporalType.DATE)
@Column(name = “last_run”, nullable = false, length = 0)
public Date getLastRun() {
return this.lastRun;
}public void setLastRun(Date lastRun) {
this.lastRun = lastRun;
}
Brian FernandesModeratorDouglas,
Please try changing @Temporal(TemporalType.DATE) to @Temporal(TemporalType.TIMESTAMP).
We have a bug filed against this issue as there is no way to override this during the RE process and the change must be made by hand.
Sorry for the inconvenience caused, I’m adding this URL to the PR to increase priority.
Douglas M HurstParticipantThank you, I will do that… in fact, I’ve done that and it works just fine… for now.
-
AuthorPosts