Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Re: Auto-fill date field

Thanks everyone, changing the field type to javax.sql.Timestamp and annotating it with @Version does the trick.

Michael

On Sun, Mar 14, 2010 at 2:29 PM, Michael Bar-sinai <mich.barsinai@xxxxxxxxx> wrote:
Hello all,
I have an event record, which has a timestamp field:
 
...
    @Temporal(TemporalType.TIMESTAMP)
    public Calendar getEventTime() {
        return eventTime;
    }
...

I would like to have the DB itself fill in the field when the entity is first persisted. This is important as I have a few servers talking to the same DB, and filling the timestamp in the java tier exposes the application to problems caused by  differences between servers' clocks (e.g. in the history table, email is received before it is sent).

Any ideas?
Thanks in advance,
Michael Bar-Sinai

p.s. Obviously, we have the systems team work on their NTP-clock-syncing stuff, but an application-level solution is always better :-)


Back to the top