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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 5.0.0.Final, 4.6.0.Final
    • 4.5.0.Final
    • JCR
    • None
    • 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.

      Attachments

        Activity

          People

            hchiorean Horia Chiorean (Inactive)
            george.ushakov George Ushakov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: