Hibernate version: 2.1
For a certain db application where we keep a queue of tasks to process in a table, we have traditionally used sql server's timestamp value as a guaranteed increasing, automatically generated binary key. (note: sql server's timestamp value is not the same as a standard SQL timestamp value) This allows us to treat the table as a queue, where we can store a timestamp value as our "current position" in the queue, and have a process wake up, and be able to step through the additions to this queue in the order they occurred, an dprocess them.
Now I am trying to get something like this to work with Hibernate, in a database-independent way. I've been looking over the different types of id generation, and some of them are sequential, but the descriptions of the algorithms are too brief (and my understanding too shallow) for me to know if any of these would be appropriate for such a situation.
The problem with using an actual "datetime" value is that the clocks of various clients could be out of sync. And I am not sure which of the hibernate generated ids are strictly increasing. The solution ideally would work with multiple clients, and as I said, be database independent.
Thanks for any advice,
Ken Larson
|