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>(org.springframework.data.domain.KeysetScrollPosition position, org.springframework.data.domain.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:
  • Field Summary

    Fields inherited from interface org.springframework.data.jpa.domain.Specification

    serialVersionUID
  • Constructor Summary

    Constructors
    Constructor
    Description
    KeysetScrollSpecification(org.springframework.data.domain.KeysetScrollPosition position, org.springframework.data.domain.Sort sort, JpaEntityInformation<?,?> entity)
    Creates an instance of a KeysetScrollSpecification record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    jakarta.persistence.criteria.Predicate
    createPredicate(jakarta.persistence.criteria.Root<?> root, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder)
     
    static org.springframework.data.domain.Sort
    createSort(org.springframework.data.domain.KeysetScrollPosition position, org.springframework.data.domain.Sort sort, JpaEntityInformation<?,?> entity)
    Create a Sort object to be used with the actual query.
    Returns the value of the entity record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    org.springframework.data.domain.KeysetScrollPosition
    Returns the value of the position record component.
    org.springframework.data.domain.Sort
    Returns the value of the sort record component.
    jakarta.persistence.criteria.Predicate
    toPredicate(jakarta.persistence.criteria.Root<T> root, jakarta.persistence.criteria.CriteriaQuery<?> query, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder)
    Creates a WHERE clause for a query of the referenced entity in form of a Predicate for the given Root and CriteriaQuery.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.springframework.data.jpa.domain.Specification

    and, or
  • Constructor Details

    • KeysetScrollSpecification

      public KeysetScrollSpecification(org.springframework.data.domain.KeysetScrollPosition position, org.springframework.data.domain.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 org.springframework.data.domain.Sort createSort(org.springframework.data.domain.KeysetScrollPosition position, org.springframework.data.domain.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 org.springframework.data.domain.KeysetScrollPosition position()
      Returns the value of the position record component.
      Returns:
      the value of the position record component
    • sort

      public org.springframework.data.domain.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