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:
-
Field Summary
Fields inherited from interface org.springframework.data.jpa.domain.Specification
serialVersionUID
-
Constructor Summary
ConstructorDescriptionKeysetScrollSpecification
(KeysetScrollPosition position, Sort sort, JpaEntityInformation<?, ?> entity) Creates an instance of aKeysetScrollSpecification
record class. -
Method Summary
Modifier and TypeMethodDescriptionjakarta.persistence.criteria.Predicate
createPredicate
(jakarta.persistence.criteria.Root<?> root, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder) static Sort
createSort
(KeysetScrollPosition position, Sort sort, JpaEntityInformation<?, ?> entity) Create aSort
object to be used with the actual query.JpaEntityInformation<?,
?> entity()
Returns the value of theentity
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.position()
Returns the value of theposition
record component.sort()
Returns the value of thesort
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 aPredicate
for the givenRoot
andCriteriaQuery
.final String
toString()
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(KeysetScrollPosition position, Sort sort, JpaEntityInformation<?, ?> entity) Creates an instance of aKeysetScrollSpecification
record class.- Parameters:
position
- the value for theposition
record componentsort
- the value for thesort
record componententity
- the value for theentity
record component
-
-
Method Details
-
createSort
public static Sort createSort(KeysetScrollPosition position, Sort sort, JpaEntityInformation<?, ?> entity) Create aSort
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 aPredicate
for the givenRoot
andCriteriaQuery
.- Specified by:
toPredicate
in interfaceSpecification<T>
- Parameters:
root
- must not be null.query
- can be null to allow overrides that acceptCriteriaDelete
which is anAbstractQuery
but noCriteriaQuery
.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
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. -
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. -
equals
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 withObjects::equals(Object,Object)
. -
position
Returns the value of theposition
record component.- Returns:
- the value of the
position
record component
-
sort
Returns the value of thesort
record component.- Returns:
- the value of the
sort
record component
-
entity
Returns the value of theentity
record component.- Returns:
- the value of the
entity
record component
-