Grails
  1. Grails
  2. GRAILS-2672

Return PagedResultList in case list* methods are provided with max and offset param

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.1
    • Fix Version/s: 2.0-RC2
    • Component/s: Persistence
    • Labels:
      None

      Description

      As far as I know only when using criteria Grails will return a PagedResultList.

      It would be really nice if all list* methods would do this in case max and/or offset params are specified.

      E.g. how it is currently

      def result = Book.createCriteria().list(max: params.max, offset: params.offset) {}
      assert result instanceof PagedResultList => TRUE

      def result = Book.list(max: 10, offset: 0)
      assert result instanceof PagedResultList => FALSE

        Issue Links

          Activity

          Hide
          Jeff Scott Brown added a comment -

          The static list(...) method now returns a PagedResultList for paginated queries.

          Show
          Jeff Scott Brown added a comment - The static list(...) method now returns a PagedResultList for paginated queries.
          Hide
          Marcel Overdijk added a comment -

          To bad findAll method is not returning PagedResultList in case max/offset param is provided.
          Have to fallback to createCriteria method instead.

          Show
          Marcel Overdijk added a comment - To bad findAll method is not returning PagedResultList in case max/offset param is provided. Have to fallback to createCriteria method instead.
          Hide
          cdeszaq added a comment -

          @MarcelOverdijk - Agreed. It would be rather nice to be able to treat all GORM-returned collections more similarly, regardless of how they are generated.

          Show
          cdeszaq added a comment - @MarcelOverdijk - Agreed. It would be rather nice to be able to treat all GORM-returned collections more similarly, regardless of how they are generated.
          Hide
          cdeszaq added a comment -

          or at least those retrieved with pagination parameters.

          Show
          cdeszaq added a comment - or at least those retrieved with pagination parameters.
          Hide
          Jeff Scott Brown added a comment -

          I think this issue addressed list(...) queries. If there are other query methods that need to be addressed a new JIRA should be filed so we can track those and implement them where that makes sense.

          Show
          Jeff Scott Brown added a comment - I think this issue addressed list(...) queries. If there are other query methods that need to be addressed a new JIRA should be filed so we can track those and implement them where that makes sense.

            People

            • Assignee:
              Jeff Scott Brown
              Reporter:
              Marcel Overdijk
            • Votes:
              18 Vote for this issue
              Watchers:
              20 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development