Uploaded image for project: 'PicketLink'
  1. PicketLink
  2. PLINK-510

JPAIdentityStore fetchQueryResults sorting params will be ignored

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • PLINK_2.7.0.Beta2
    • PLINK_2.5.2.FInal, PLINK_2.7.0.Beta1
    • IDM
    • None

      In my test I created some test user:

      User user1 = createUser("a", "a", "a", "a", "a");
      User user2 = createUser("b", "b", "b", "b", "b");
      User user3 = createUser("c", "c", "c", "c", "c");
      User user4 = createUser("d", "d", "d", "d", "d");
      

      Next if I want to find all users ordered by lastName, I create follow queries:

      IdentityQuery<User> userIdentityQuery1 = identityManager.createIdentityQuery(User.class)
                      .setLimit(max)
                      .setOffset(offset)
                      .setSortParameters(User.LAST_NAME)
                      .setSortAscending(true);
      
      IdentityQuery<User> userIdentityQuery2 = identityManager.createIdentityQuery(User.class)
                      .setLimit(max)
                      .setOffset(offset)
                      .setSortParameters(User.LAST_NAME)
                      .setSortAscending(false);
      

      The result lists of both queries are equal.
      I debugged into JPAIdentityStore.fetchQueryResults(...) and saw, that the sort parameters will not be read. The method orderBy of CriteriaQuery will not be called.

      The FileIdentityStore.fetchQueryResults(...) uses the FileSortingComparator to sort the result. I can use it too, but it is better to use the jpa means.

              psilva@redhat.com Pedro Igor Craveiro
              andropolis Andrej Anafinow (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: