Class PagingJpaQueryIterable<T,R>

java.lang.Object
org.axonframework.common.legacyjpa.PagingJpaQueryIterable<T,R>
Type Parameters:
T - The query result type.
R - The mapped result type.
All Implemented Interfaces:
Iterable<R>

@Deprecated public class PagingJpaQueryIterable<T,R> extends Object implements Iterable<R>
Deprecated.
in favor of using PagingJpaQueryIterable which moved to jakarta.
Enables iterating through a JPA query using paging while lazily mapping the results when necessary. Paging is taken care of automatically, fetching the next page when the items run out to iterate through.

Do not use this for paging when you care about concurrent deletes. If you loaded a page, delete an item from it, and load the next, you will miss an item during iteration.

The iterator() function can be called multiple times to loop through the items, restarting the query from the start.

Since:
4.6.0
Author:
Mitchell Herrijgers
  • Constructor Details

    • PagingJpaQueryIterable

      public PagingJpaQueryIterable(int pageSize, TransactionManager transactionManager, Supplier<javax.persistence.TypedQuery<T>> querySupplier, Function<T,R> lazyMappingFunction)
      Deprecated.
      Constructs a new Iterable using the provided querySupplier to construct queries when a new page needs to be fetched. Items are lazily mapped by the provided lazyMappingFunction when iterating.
      Parameters:
      pageSize - The size of the pages.
      transactionManager - The TransactionManager to use when fetching items.
      querySupplier - The supplier of the queries. Will be invoked for each page.
      lazyMappingFunction - The mapping function to map items to the desired representation.
  • Method Details