From 6ab972cfb17c49a4824a9ee48a8f73d42aeeeebe Mon Sep 17 00:00:00 2001 From: KIM MIN WOO <79193811+minwoo1999@users.noreply.github.com> Date: Tue, 17 Dec 2024 22:33:24 +0900 Subject: [PATCH] Refactor: Remove unused query parameter in getCountQuery method --- .../data/jpa/repository/query/JpaCountQueryCreator.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaCountQueryCreator.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaCountQueryCreator.java index 851a867214..e0c6892855 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaCountQueryCreator.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaCountQueryCreator.java @@ -63,14 +63,15 @@ protected CriteriaQuery createCriteriaQuery(CriteriaBuilder bu @Override @SuppressWarnings("unchecked") protected CriteriaQuery complete(@Nullable Predicate predicate, Sort sort, - CriteriaQuery query, CriteriaBuilder builder, Root root) { + CriteriaQuery query, CriteriaBuilder builder, Root root) { - CriteriaQuery select = query.select(getCountQuery(query, builder, root)); + CriteriaQuery select = query.select(getCountQuery(builder, root)); return predicate == null ? select : select.where(predicate); } + @SuppressWarnings("rawtypes") - private Expression getCountQuery(CriteriaQuery query, CriteriaBuilder builder, Root root) { + private Expression getCountQuery(CriteriaBuilder builder, Root root) { return distinct ? builder.countDistinct(root) : builder.count(root); } }