16
16
package org .springframework .data .couchbase .repository .query ;
17
17
18
18
import static org .springframework .data .couchbase .core .query .N1QLExpression .i ;
19
- import static org .springframework .data .couchbase .core .query .N1QLExpression .meta ;
20
- import static org .springframework .data .couchbase .core .query .N1QLExpression .path ;
21
19
import static org .springframework .data .couchbase .core .query .N1QLExpression .x ;
22
20
import static org .springframework .data .couchbase .core .support .TemplateUtils .SELECT_CAS ;
23
21
import static org .springframework .data .couchbase .core .support .TemplateUtils .SELECT_ID ;
31
29
32
30
import org .slf4j .Logger ;
33
31
import org .slf4j .LoggerFactory ;
34
- import org .springframework .core .convert .converter .Converter ;
35
32
import org .springframework .data .couchbase .core .convert .CouchbaseConverter ;
36
33
import org .springframework .data .couchbase .core .mapping .CouchbasePersistentProperty ;
37
34
import org .springframework .data .couchbase .core .query .N1QLExpression ;
38
35
import org .springframework .data .couchbase .repository .Query ;
39
36
import org .springframework .data .couchbase .repository .query .support .N1qlUtils ;
40
37
import org .springframework .data .domain .Pageable ;
41
- import org .springframework .data .domain .Sort ;
42
38
import org .springframework .data .mapping .PersistentEntity ;
43
39
import org .springframework .data .mapping .PersistentPropertyPath ;
44
40
import org .springframework .data .mapping .PropertyHandler ;
@@ -197,7 +193,7 @@ private void getProjectedFieldsInternal(String bucketName, CouchbasePersistentPr
197
193
TypeInformation resultClass /*, String path*/ ) {
198
194
199
195
PersistentEntity persistentEntity = couchbaseConverter .getMappingContext ().getPersistentEntity (resultClass );
200
- //CouchbasePersistentProperty property = path.getLeafProperty();
196
+ // CouchbasePersistentProperty property = path.getLeafProperty();
201
197
persistentEntity .doWithProperties (new PropertyHandler <CouchbasePersistentProperty >() {
202
198
@ Override
203
199
public void doWithPersistentProperty (final CouchbasePersistentProperty prop ) {
@@ -207,7 +203,8 @@ public void doWithPersistentProperty(final CouchbasePersistentProperty prop) {
207
203
if (prop .isVersionProperty ()) {
208
204
return ;
209
205
}
210
- PersistentPropertyPath <CouchbasePersistentProperty > path = couchbaseConverter .getMappingContext ().getPersistentPropertyPath (prop .getName (), resultClass .getType ());
206
+ PersistentPropertyPath <CouchbasePersistentProperty > path = couchbaseConverter .getMappingContext ()
207
+ .getPersistentPropertyPath (prop .getName (), resultClass .getType ());
211
208
212
209
// The current limitation is that only top-level properties can be projected
213
210
// This traversing of nested data structures would need to replicate the processing done by
@@ -495,16 +492,7 @@ private N1QLExpression getExpression(ParameterAccessor accessor, Object[] runtim
495
492
runtimeParameters );
496
493
N1QLExpression parsedStatement = x (this .doParse (parser , evaluationContext , isCountQuery ));
497
494
498
- Sort sort = accessor .getSort ();
499
- if (sort .isSorted ()) {
500
- N1QLExpression [] cbSorts = N1qlUtils .createSort (sort );
501
- parsedStatement = parsedStatement .orderBy (cbSorts );
502
- }
503
- if (queryMethod .isPageQuery ()) {
504
- Pageable pageable = accessor .getPageable ();
505
- Assert .notNull (pageable , "Pageable must not be null!" );
506
- parsedStatement = parsedStatement .limit (pageable .getPageSize ()).offset (Math .toIntExact (pageable .getOffset ()));
507
- } else if (queryMethod .isSliceQuery ()) {
495
+ if (queryMethod .isSliceQuery ()) {
508
496
Pageable pageable = accessor .getPageable ();
509
497
Assert .notNull (pageable , "Pageable must not be null!" );
510
498
parsedStatement = parsedStatement .limit (pageable .getPageSize () + 1 ).offset (Math .toIntExact (pageable .getOffset ()));
@@ -518,6 +506,8 @@ private static Object[] getParameters(ParameterAccessor accessor) {
518
506
for (Object o : accessor ) {
519
507
params .add (o );
520
508
}
509
+ params .add (accessor .getPageable ());
510
+ params .add (accessor .getSort ());
521
511
return params .toArray ();
522
512
}
523
513
}
0 commit comments