Record Class KeysetScrollSpecification<T>

java.lang.Object
java.lang.Record
org.springframework.data.jpa.repository.query.KeysetScrollSpecification<T>
All Implemented Interfaces:
Serializable, Specification<T>

public record KeysetScrollSpecification<T>(KeysetScrollPosition position, Sort sort, JpaEntityInformation<?,?> entity) extends Record implements Specification<T>
Specification to create scroll queries using keyset-scrolling.
Since:
3.1
Author:
Mark Paluch, Christoph Strobl
See Also:
  • Constructor Details

    • KeysetScrollSpecification

      public KeysetScrollSpecification(KeysetScrollPosition position, Sort sort, JpaEntityInformation<?,?> entity)
      Creates an instance of a KeysetScrollSpecification record class.
      Parameters:
      position - the value for the position record component
      sort - the value for the sort record component
      entity - the value for the entity record component
  • Method Details

    • createSort

      public static Sort createSort(KeysetScrollPosition position, Sort sort, JpaEntityInformation<?,?> entity)
      Create a Sort object to be used with the actual query.
      Parameters:
      position - must not be null.
      sort - must not be null.
      entity - must not be null.
    • toPredicate

      public jakarta.persistence.criteria.Predicate toPredicate(jakarta.persistence.criteria.Root<T> root, jakarta.persistence.criteria.CriteriaQuery<?> query, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder)
      Description copied from interface: Specification
      Creates a WHERE clause for a query of the referenced entity in form of a Predicate for the given Root and CriteriaQuery.
      Specified by:
      toPredicate in interface Specification<T>
      Parameters:
      root - must not be null.
      query - must not be null.
      criteriaBuilder - must not be null.
      Returns:
      a Predicate, may be null.
    • createPredicate

      @Nullable public jakarta.persistence.criteria.Predicate createPredicate(jakarta.persistence.criteria.Root<?> root, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • position

      public KeysetScrollPosition position()
      Returns the value of the position record component.
      Returns:
      the value of the position record component
    • sort

      public Sort sort()
      Returns the value of the sort record component.
      Returns:
      the value of the sort record component
    • entity

      public JpaEntityInformation<?,?> entity()
      Returns the value of the entity record component.
      Returns:
      the value of the entity record component