Package io.ebean.config.dbplatform
Class SimpleSequenceIdGenerator
- java.lang.Object
-
- io.ebean.config.dbplatform.SimpleSequenceIdGenerator
-
- All Implemented Interfaces:
PlatformIdGenerator
public class SimpleSequenceIdGenerator extends Object implements PlatformIdGenerator
A very simple Database sequence based IdGenerator.One which batch requests sequence Id's would be better for performance.
-
-
Field Summary
-
Fields inherited from interface io.ebean.config.dbplatform.PlatformIdGenerator
AUTO_UUID
-
-
Constructor Summary
Constructors Constructor Description SimpleSequenceIdGenerator(DataSource dataSource, String sql, String seqName)
Construct given a dataSource and sql to return the next sequence value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getName()
Return the name of the IdGenerator.boolean
isDbSequence()
Return true if this is a DB sequence.Object
nextId(Transaction t)
return the next unique identity value.void
preAllocateIds(int batchSize)
Is called prior to inserting OneToMany's as an indication that a number of beans are likely to need id's shortly.
-
-
-
Constructor Detail
-
SimpleSequenceIdGenerator
public SimpleSequenceIdGenerator(DataSource dataSource, String sql, String seqName)
Construct given a dataSource and sql to return the next sequence value.
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:PlatformIdGenerator
Return the name of the IdGenerator. For sequences this is the sequence name.- Specified by:
getName
in interfacePlatformIdGenerator
-
isDbSequence
public boolean isDbSequence()
Description copied from interface:PlatformIdGenerator
Return true if this is a DB sequence.- Specified by:
isDbSequence
in interfacePlatformIdGenerator
-
preAllocateIds
public void preAllocateIds(int batchSize)
Description copied from interface:PlatformIdGenerator
Is called prior to inserting OneToMany's as an indication that a number of beans are likely to need id's shortly.Can be used as a performance optimisation to prefetch a number of Id's. Especially when the allocateSize is very large.
- Specified by:
preAllocateIds
in interfacePlatformIdGenerator
-
nextId
public Object nextId(Transaction t)
Description copied from interface:PlatformIdGenerator
return the next unique identity value.Note the transaction passed in can be null.
- Specified by:
nextId
in interfacePlatformIdGenerator
-
-