facebook

MySQL spring/jpa/dao updates

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #286526 Reply

    Douglas M Hurst
    Participant

    I’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;
    }

    #286557 Reply

    Brian Fernandes
    Moderator

    Douglas,

    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.

    #286576 Reply

    Douglas M Hurst
    Participant

    Thank you, I will do that… in fact, I’ve done that and it works just fine… for now.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: MySQL spring/jpa/dao updates

This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.

You must be logged in to post in the forum log in