Module io.ebean.api

Class SequenceIdGenerator

    • Field Detail

      • log

        protected static final org.slf4j.Logger log
      • seqName

        protected final String seqName
      • dataSource

        protected final DataSource dataSource
      • allocationSize

        protected final int allocationSize
      • currentlyBackgroundLoading

        protected AtomicBoolean currentlyBackgroundLoading
    • Constructor Detail

      • SequenceIdGenerator

        protected SequenceIdGenerator​(BackgroundExecutor be,
                                      DataSource ds,
                                      String seqName,
                                      int allocationSize)
        Construct given a dataSource and sql to return the next sequence value.
    • Method Detail

      • getSql

        public abstract String getSql​(int batchSize)
      • 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:
        preAllocateIds in interface PlatformIdGenerator
      • loadInBackground

        protected void loadInBackground​(int requestSize)
        Load another batch of Id's using a background thread.
      • getMoreIds

        protected List<Long> getMoreIds​(int requestSize)
        Get more Id's by executing a query and reading the Id's returned.