|
37 | 37 | import org.springframework.data.couchbase.core.query.N1QLExpression;
|
38 | 38 | import org.springframework.data.couchbase.repository.Query;
|
39 | 39 | import org.springframework.data.couchbase.repository.query.support.N1qlUtils;
|
40 |
| -import org.springframework.data.domain.Pageable; |
41 | 40 | import org.springframework.data.mapping.PersistentEntity;
|
42 | 41 | import org.springframework.data.mapping.PersistentPropertyPath;
|
43 | 42 | import org.springframework.data.mapping.PropertyHandler;
|
@@ -135,7 +134,7 @@ public StringBasedN1qlQueryParser(String statement, CouchbaseQueryMethod queryMe
|
135 | 134 | false, null, null);
|
136 | 135 | this.countContext = createN1qlSpelValues(bucketName, collection, queryMethod.getEntityInformation().getJavaType(),
|
137 | 136 | queryMethod.getReturnedObjectType(), typeField, typeValue, true, null, null);
|
138 |
| - this.parsedExpression = getExpression(accessor, getParameters(accessor), null, parser, evaluationContextProvider); |
| 137 | + this.parsedExpression = getExpression(accessor, null, parser, evaluationContextProvider); |
139 | 138 | checkPlaceholders(this.parsedExpression.toString());
|
140 | 139 | }
|
141 | 140 |
|
@@ -188,7 +187,8 @@ public N1qlSpelValues createN1qlSpelValues(String bucketName, String collection,
|
188 | 187 | return new N1qlSpelValues(selectEntity, entity, i(b).toString(), typeSelection, delete, returning);
|
189 | 188 | }
|
190 | 189 |
|
191 |
| - private String getProjectedOrDistinctFields(String b, Class resultClass, String typeField, String[] fields, String[] distinctFields) { |
| 190 | + private String getProjectedOrDistinctFields(String b, Class resultClass, String typeField, String[] fields, |
| 191 | + String[] distinctFields) { |
192 | 192 | if (distinctFields != null && distinctFields.length != 0) {
|
193 | 193 | return i(distinctFields).toString();
|
194 | 194 | }
|
@@ -217,7 +217,7 @@ private void getProjectedFieldsInternal(String bucketName, CouchbasePersistentPr
|
217 | 217 | if (prop == persistentEntity.getVersionProperty() && parent == null) {
|
218 | 218 | return;
|
219 | 219 | }
|
220 |
| - if( prop.getFieldName().equals(typeField)) // typeField already projected |
| 220 | + if (prop.getFieldName().equals(typeField)) // typeField already projected |
221 | 221 | return;
|
222 | 222 | // for distinct when no distinctFields were provided, do not include the expiration field.
|
223 | 223 | if (forDistinct && prop.findAnnotation(Expiration.class) != null && parent == null) {
|
@@ -528,23 +528,17 @@ public N1qlSpelValues(String selectClause, String entityFields, String bucket, S
|
528 | 528 | }
|
529 | 529 |
|
530 | 530 | // copied from StringN1qlBasedQuery
|
531 |
| - private N1QLExpression getExpression(ParameterAccessor accessor, Object[] runtimeParameters, |
| 531 | + private N1QLExpression getExpression(ParameterAccessor accessor, |
532 | 532 | ReturnedType returnedType, SpelExpressionParser parser,
|
533 | 533 | QueryMethodEvaluationContextProvider evaluationContextProvider) {
|
534 | 534 | boolean isCountQuery = queryMethod.isCountQuery();
|
| 535 | + Object[] runtimeParameters = getParameters(accessor); |
535 | 536 | EvaluationContext evaluationContext = evaluationContextProvider.getEvaluationContext(queryMethod.getParameters(),
|
536 | 537 | runtimeParameters);
|
537 | 538 | N1QLExpression parsedStatement = x(this.doParse(parser, evaluationContext, isCountQuery));
|
538 |
| - |
539 |
| - if (queryMethod.isSliceQuery()) { |
540 |
| - Pageable pageable = accessor.getPageable(); |
541 |
| - Assert.notNull(pageable, "Pageable must not be null!"); |
542 |
| - parsedStatement = parsedStatement.limit(pageable.getPageSize() + 1).offset(Math.toIntExact(pageable.getOffset())); |
543 |
| - } |
544 | 539 | return parsedStatement;
|
545 | 540 | }
|
546 | 541 |
|
547 |
| - // getExpression() could do this itself, but pass as an arg to be consistent with StringN1qlBasedQuery |
548 | 542 | private static Object[] getParameters(ParameterAccessor accessor) {
|
549 | 543 | ArrayList<Object> params = new ArrayList<>();
|
550 | 544 | for (Object o : accessor) {
|
|
0 commit comments