ObjectDB ObjectDB

auto generate timestamp

#1

Hi all,

How can I create auto timestamping column?

I want the database to generate the timestamp.

I tried google but suggested solutions doesn't work in objectDB.

http://stackoverflow.com/questions/811845/setting-a-jpa-timestamp-column-to-be-generated-by-the-database

- Pawel

 

edit
delete
#2

Yes, currently ObjectDB supports only numeric values in version fields.

However, you can hold the timestamp in an ordinary Date / Timestamp field and update it in an event callback method (@PrePersist, @PreUpdate).

ObjectDB Support
edit
delete
#3

Not always...
If your server runs on separate computer and clients clocks are not synchronized or what worse are from different time zone’s you can have a troubles...

edit
delete
#4

You are right - a version field is preferred. It will be supported in future versions.

You can, however, use the server time in the event callback by running a query (not very efficient but should work).

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.