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

 

#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
ObjectDB - Fast Object Database for Java (JPA/JDO)
#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...

#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
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login