|
17 | 17 |
|
18 | 18 | import jakarta.persistence.EntityManager;
|
19 | 19 | import jakarta.persistence.Query;
|
| 20 | + |
20 | 21 | import org.springframework.data.domain.Pageable;
|
21 | 22 | import org.springframework.data.domain.Sort;
|
22 | 23 | import org.springframework.data.jpa.repository.QueryRewriter;
|
@@ -80,16 +81,17 @@ public AbstractStringBasedJpaQuery(JpaQueryMethod method, EntityManager em, Stri
|
80 | 81 |
|
81 | 82 | this.countQuery = Lazy.of(() -> {
|
82 | 83 |
|
83 |
| - if(StringUtils.hasText(countQueryString)) { |
| 84 | + if (StringUtils.hasText(countQueryString)) { |
84 | 85 |
|
85 | 86 | return new ExpressionBasedStringQuery(countQueryString, method.getEntityInformation(), parser,
|
86 | 87 | method.isNativeQuery());
|
87 | 88 | }
|
88 |
| - return query.deriveCountQuery(null, method.getCountQueryProjection()); |
| 89 | + |
| 90 | + return query.deriveCountQuery(method.getCountQueryProjection()); |
89 | 91 | });
|
90 | 92 |
|
91 | 93 | this.countParameterBinder = Lazy.of(() -> {
|
92 |
| - return this.createCountBinder(this.countQuery.get()); |
| 94 | + return this.createBinder(this.countQuery.get()); |
93 | 95 | });
|
94 | 96 |
|
95 | 97 | this.parser = parser;
|
@@ -118,15 +120,14 @@ public Query doCreateQuery(JpaParametersParameterAccessor accessor) {
|
118 | 120 |
|
119 | 121 | @Override
|
120 | 122 | protected ParameterBinder createBinder() {
|
| 123 | + return createBinder(query); |
| 124 | + } |
121 | 125 |
|
| 126 | + protected ParameterBinder createBinder(DeclaredQuery query) { |
122 | 127 | return ParameterBinderFactory.createQueryAwareBinder(getQueryMethod().getParameters(), query, parser,
|
123 | 128 | evaluationContextProvider);
|
124 | 129 | }
|
125 | 130 |
|
126 |
| - protected ParameterBinder createCountBinder(DeclaredQuery countQuery) { |
127 |
| - return ParameterBinderFactory.createQueryAwareBinder(getQueryMethod().getParameters(), countQuery, parser, evaluationContextProvider); |
128 |
| - } |
129 |
| - |
130 | 131 | @Override
|
131 | 132 | protected Query doCreateCountQuery(JpaParametersParameterAccessor accessor) {
|
132 | 133 |
|
|
0 commit comments