SequenceGenerator

A utility class that generates unique sequences of Long values. It uses a database table to store the next value to give out for a particular key. To reduce the number of hits on the database it "grabs" a range of values instead of a single value. The downside of this is that if the application server is restarted, any unused grabbed values will no longer be available.

SequenceGenerator is used in the DAO classes to generate unique IDs when creating new records.

The "grab" size is configurable via the sequenceGenerator.grabSize property in application.properties.

Related topics

DAO