Package io.higson.runtime.hilo
Class HiLoSequenceGenerator
java.lang.Object
io.higson.runtime.hilo.HiLoSequenceGenerator
- All Implemented Interfaces:
IdentifierGenerator
Classic hi-lo identifier generator. Reserves a contiguous buffer of
allocationSize ids per
single database round-trip.
Requires the underlying sequence to be declared with INCREMENT BY 1. Each
nextval() returns a hi value; the generator multiplies it by allocationSize to
derive the buffer boundaries.
For a sequence starting at 1 with INCREMENT BY 1 and allocationSize = 50:
- first
nextval()returns1→ buffer [50, 99] - second
nextval()returns2→ buffer [100, 149]
-
Constructor Summary
ConstructorsConstructorDescriptionHiLoSequenceGenerator(String sequenceName, int allocationSize, IdentifierDao dao) -
Method Summary
-
Constructor Details
-
HiLoSequenceGenerator
-
-
Method Details
-
getNextId
public long getNextId()- Specified by:
getNextIdin interfaceIdentifierGenerator
-
toString
-