glassfish
  1. glassfish
  2. GLASSFISH-344

Using Query.setFirstResult and setMaxResults return incorrect rows

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 9.0pe
    • Fix Version/s: 9.0pe_dev
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      344

      Description

      Bug in b32g using javax.persistence.Query.setFirstResult and setMaxResults.

      I have a query which returns 9 records (1,2,3,..9).

      When I do:
      l = q.getResultList();
      System.out.println("l.size=" + l.size());
      The result is 1,2,3,4,5,6,7,8,9 - OK

      When I do:
      q.setMaxResults(5);
      q.setFirstResult(0);
      l = q.getResultList();
      The result is 1,2,3,4,5 - OK

      When I do:
      q.setMaxResults(5);
      q.setFirstResult(2);
      l = q.getResultList();
      The result is 3,4,5 - NOT OK, SHOULD BE 3,4,5,6,7

      Regards,
      Marcel

        Activity

        Hide
        marina vatkina added a comment -

        Reassigned

        Show
        marina vatkina added a comment - Reassigned
        Hide
        pkrogh added a comment -

        This should be accomplished simply by adding setFirstResult to setMaxRows
        before setting max rows. Look in DatasourceAccessor for the location to put
        this fix.

        Show
        pkrogh added a comment - This should be accomplished simply by adding setFirstResult to setMaxRows before setting max rows. Look in DatasourceAccessor for the location to put this fix.
        Hide
        marina vatkina added a comment -

        Please take a look

        Show
        marina vatkina added a comment - Please take a look
        Hide
        mb124283 added a comment -

        Started looking into this.

        Show
        mb124283 added a comment - Started looking into this.
        Hide
        mb124283 added a comment -

        Fixed the implementation of setMaxResults.

        Show
        mb124283 added a comment - Fixed the implementation of setMaxResults.

          People

          • Assignee:
            mb124283
            Reporter:
            marceloverdijk
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: