Module io.ebean.api

Class 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.

    • 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

      • 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 interface PlatformIdGenerator