java.lang.Object
io.ebean.config.dbplatform.SequenceIdGenerator
- All Implemented Interfaces:
PlatformIdGenerator
- Direct Known Subclasses:
SequenceBatchIdGenerator,SequenceStepIdGenerator
Database sequence based IdGenerator.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intprotected final BackgroundExecutorprotected AtomicBooleanprotected final DataSourceprotected final NavigableSet<Long>protected static final org.slf4j.Loggerprotected final StringFields inherited from interface io.ebean.config.dbplatform.PlatformIdGenerator
AUTO_UUID -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSequenceIdGenerator(BackgroundExecutor be, DataSource ds, String seqName, int allocationSize) Construct given a dataSource and sql to return the next sequence value. -
Method Summary
Modifier and TypeMethodDescriptiongetMoreIds(int requestSize) Get more Id's by executing a query and reading the Id's returned.getName()Returns the sequence name.abstract StringgetSql(int batchSize) booleanReturns true.protected voidloadInBackground(int requestSize) Load another batch of Id's using a background thread.Return the next Id.voidpreAllocateIds(int requestSize) If allocateSize is large load some sequences in a background thread.Read the resultSet returning the list of Id values.
-
Field Details
-
log
protected static final org.slf4j.Logger log -
seqName
-
dataSource
-
backgroundExecutor
-
idList
-
allocationSize
protected final int allocationSize -
currentlyBackgroundLoading
-
-
Constructor Details
-
SequenceIdGenerator
protected SequenceIdGenerator(BackgroundExecutor be, DataSource ds, String seqName, int allocationSize) Construct given a dataSource and sql to return the next sequence value.
-
-
Method Details
-
getSql
-
getName
Returns the sequence name.- Specified by:
getNamein interfacePlatformIdGenerator
-
isDbSequence
public boolean isDbSequence()Returns true.- Specified by:
isDbSequencein interfacePlatformIdGenerator
-
preAllocateIds
public void preAllocateIds(int requestSize) If allocateSize is large load some sequences in a background thread.For example, when inserting a bean with a cascade on a OneToMany with many beans Ebean can call this to ensure .
- Specified by:
preAllocateIdsin interfacePlatformIdGenerator
-
nextId
Return the next Id.If a Transaction has been passed in use the Connection from it.
- Specified by:
nextIdin interfacePlatformIdGenerator
-
loadInBackground
protected void loadInBackground(int requestSize) Load another batch of Id's using a background thread. -
readIds
Read the resultSet returning the list of Id values.- Throws:
SQLException
-
getMoreIds
Get more Id's by executing a query and reading the Id's returned.
-