Page 1 of 1

SEQUENCE_GENERATOR table

Posted: Thu Oct 25, 2012 11:38 am
by alexhutnik
Looking through the ER diagrams (thanks for posting those) as well as the packaged SQL scripts, I noticed the SEQUENCE_GENERATOR table. I get the impression that's to store data for primary key generation. Is that correct? If so, why not use the database auto-increment? It seems to me that you would run into integrity issues in a clustered environment by not synchronizing those transactions across nodes.

Re: SEQUENCE_GENERATOR table

Posted: Fri Nov 16, 2012 4:43 pm
by jefffischer
Our approach supports a wide variety of platforms out-of-the-box and is a widely utilized approach with Hibernate. It works quite well, even in clustered environments. Each cluster node loads a batch of ids into memory and doles those out, only going back to the server when no more ids are available. When hitting the database for new ids, the row is locked under a transaction so that different nodes will not get the same batch of ids.