Record Class JPAFinder.CriteriaBuilderAndRoot<TT>
java.lang.Object
java.lang.Record
com.flowlogix.api.dao.JPAFinder.CriteriaBuilderAndRoot<TT>
- Type Parameters:
TT
-- Record Components:
builder
-root
-
public static record JPAFinder.CriteriaBuilderAndRoot<TT>(CriteriaBuilder builder, Root<TT> root)
extends Record
Partial query criteria, only
CriteriaBuilder
and Root
Used by enriched count and find query methods / lambdas
public record CountAndList(long count, List<UserEntity> list) { };
public CountAndList countAndList(String userName) {
// add "where fullName = 'userName'" clause
QueryEnhancement<UserEntity> enhancement = (partial, criteria) -> criteria
.where(partial.builder().equal(partial.root()
.get(UserEntity_.fullName), userName));
return new CountAndList(jpaFinder.count(enhancement::accept),
jpaFinder.findAll(enhancement::accept)
.setHint(QueryHints.BATCH_TYPE, BatchFetchType.IN)
.getResultList());
}
- Author:
- lprimak
-
Constructor Summary
ConstructorsConstructorDescriptionCriteriaBuilderAndRoot
(CriteriaBuilder builder, Root<TT> root) Creates an instance of aCriteriaBuilderAndRoot
record class. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Returns the value of thebuilder
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.root()
Returns the value of theroot
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
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)
. -
builder
-
root
-