Class BatchedQueries

java.lang.Object
google.registry.persistence.transaction.BatchedQueries

public final class BatchedQueries extends Object
Helper for querying large data sets in batches.
  • Method Details

    • loadAllOf

      public static <T> Stream<com.google.common.collect.ImmutableList<T>> loadAllOf(Class<T> entityType)
    • loadAllOf

      public static <T> Stream<com.google.common.collect.ImmutableList<T>> loadAllOf(Class<T> entityType, int batchSize)
    • loadAllOf

      public static <T> Stream<com.google.common.collect.ImmutableList<T>> loadAllOf(JpaTransactionManager jpaTm, Class<T> entityType, int batchSize)
      Loads all entities of type T in batches.

      This method must not be nested in any transaction; same for the traversal of the returned Stream. Each batch is loaded in a separate transaction at the TRANSACTION_REPEATABLE_READ isolation level, and loads the snapshot of the batch at the batch's start time. New insertions or updates since then are not reflected in the result.