Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2564

QueryBuilder does not remember changes to "limit" or "offset".

    Details

    • Steps to Reproduce:
      Hide

      Here is a unit test to reproduce the problem.

       QueryBuilder queryBuilder = new QueryBuilder(new ExecutionContext().getValueFactories().getTypeSystem());
              QueryCommand query = queryBuilder.selectStar().fromAllNodes().limit(10).query();
              System.out.println(query);
              // prints SELECT * FROM [__ALLNODES__]
              // instead of SELECT * FROM [__ALLNODES__] LIMIT 10
      
      Show
      Here is a unit test to reproduce the problem. QueryBuilder queryBuilder = new QueryBuilder( new ExecutionContext().getValueFactories().getTypeSystem()); QueryCommand query = queryBuilder.selectStar().fromAllNodes().limit(10).query(); System .out.println(query); // prints SELECT * FROM [__ALLNODES__] // instead of SELECT * FROM [__ALLNODES__] LIMIT 10

      Description

      Seems to affect all of 4.x (and possibly 5.0.0-Alpha1) versions.

      org.modeshape.jcr.query.QueryBuilder does not register any LIMIT after the call to "limit" method. The same issue is with the "offset" method, as well.

      The code in the method should probably be something like this:

      public QueryBuilder limit( int rowLimit ) {
             // this.limit.withRowLimit(rowLimit);
      
      this.limit = this.limit.withRowLimit(rowLimit);
              return this;
          }
      

      This way LIMIT attribute of the builder is correctly reinitialized with the provided rowLimit.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                hchiorean Horia Chiorean
                Reporter:
                george.ushakov George Ushakov
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: