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:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionKeysetScrollSpecification(KeysetScrollPosition position, Sort sort, JpaEntityInformation<?, ?> entity) Creates an instance of aKeysetScrollSpecificationrecord class. -
Method Summary
Modifier and TypeMethodDescription@Nullable JpqlQueryBuilder.PredicatecreateJpqlPredicate(jakarta.persistence.metamodel.Metamodel metamodel, jakarta.persistence.metamodel.Bindable<?> from, JpqlQueryBuilder.Entity entity, KeysetScrollSpecification.ParameterFactory factory) @Nullable jakarta.persistence.criteria.PredicatecreatePredicate(jakarta.persistence.criteria.Root<?> root, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder) static SortcreateSort(KeysetScrollPosition position, Sort sort, JpaEntityInformation<?, ?> entity) Create aSortobject to be used with the actual query.JpaEntityInformation<?, ?> entity()Returns the value of theentityrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.position()Returns the value of thepositionrecord component.sort()Returns the value of thesortrecord component.@Nullable jakarta.persistence.criteria.PredicatetoPredicate(jakarta.persistence.criteria.Root<T> root, @Nullable jakarta.persistence.criteria.CriteriaQuery<?> query, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder) Creates a WHERE clause for a query of the referenced entity in form of aPredicatefor the givenRootandCriteriaUpdate.final StringtoString()Returns a string representation of this record class.Methods inherited from interface Specification
and, and, or, or
-
Constructor Details
-
KeysetScrollSpecification
public KeysetScrollSpecification(KeysetScrollPosition position, Sort sort, JpaEntityInformation<?, ?> entity) Creates an instance of aKeysetScrollSpecificationrecord class.- Parameters:
position- the value for thepositionrecord componentsort- the value for thesortrecord componententity- the value for theentityrecord component
-
-
Method Details
-
createSort
public static Sort createSort(KeysetScrollPosition position, Sort sort, JpaEntityInformation<?, ?> entity) Create aSortobject 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 @Nullable jakarta.persistence.criteria.Predicate toPredicate(jakarta.persistence.criteria.Root<T> root, @Nullable jakarta.persistence.criteria.CriteriaQuery<?> query, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder) Description copied from interface:SpecificationCreates a WHERE clause for a query of the referenced entity in form of aPredicatefor the givenRootandCriteriaUpdate.- Specified by:
toPredicatein interfaceSpecification<T>- Parameters:
root- must not be null.query- the criteria query.criteriaBuilder- must not be null.- Returns:
- a
Predicate, may be null.
-
createPredicate
public @Nullable jakarta.persistence.criteria.Predicate createPredicate(jakarta.persistence.criteria.Root<?> root, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder) -
createJpqlPredicate
public @Nullable JpqlQueryBuilder.Predicate createJpqlPredicate(jakarta.persistence.metamodel.Metamodel metamodel, jakarta.persistence.metamodel.Bindable<?> from, JpqlQueryBuilder.Entity entity, KeysetScrollSpecification.ParameterFactory factory) -
toString
-
hashCode
-
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 thepositionrecord component.- Returns:
- the value of the
positionrecord component
-
sort
Returns the value of thesortrecord component.- Returns:
- the value of the
sortrecord component
-
entity
Returns the value of theentityrecord component.- Returns:
- the value of the
entityrecord component
-