auto generate timestamp


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.

- Pawel



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

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...


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