Spring Data JPA
  1. Spring Data JPA
  2. DATAJPA-296

Sort does not support case insensitive sorting

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3 GA
    • Fix Version/s: 1.4 M1
    • Component/s: Core
    • Labels:
      None

      Description

      Currently when using the Sort class in the findAll method, the results returned are always case sensitive. For example, if the following names were sorted they would be returned in this order:
      Dave
      Oliver
      kevin

      I'm proposing that when sorting on properties that are Strings that it is possible to have the sort be case insensitive so that the results above would be returned as:
      Dave
      kevin
      Oliver

        Issue Links

          Activity

          Hide
          Oliver Gierke added a comment -

          The commit that introduced the fix is here: https://github.com/SpringSource/spring-data-jpa/commit/4c65ad1df6ea281036b5d35c25473a57f0bc3ac0. So it should be included in the latest snapshots, i.e. the one you have.

          Show
          Oliver Gierke added a comment - The commit that introduced the fix is here: https://github.com/SpringSource/spring-data-jpa/commit/4c65ad1df6ea281036b5d35c25473a57f0bc3ac0 . So it should be included in the latest snapshots, i.e. the one you have.
          Hide
          Iulian Stefanica added a comment -

          OK, it was there, I figured out why (or more precise what/when) it doesn't work. Now it looks like it's working for methods like the one above. But it doesn't work for something like: `preApprovalRequestRepository.findAll(current().and(createdBy(auth.getName())), pageRequest))`. That's a method using QueryDsl predicates. It looks like it's adding the order by clause (and paging), but ignores the ignoreCase flag for such methods.

          Show
          Iulian Stefanica added a comment - OK, it was there, I figured out why (or more precise what/when) it doesn't work. Now it looks like it's working for methods like the one above. But it doesn't work for something like: `preApprovalRequestRepository.findAll(current().and(createdBy(auth.getName())), pageRequest))`. That's a method using QueryDsl predicates. It looks like it's adding the order by clause (and paging), but ignores the ignoreCase flag for such methods.
          Hide
          Iulian Stefanica added a comment -

          OK, it was there, I figured out why (or more precise what/when) it doesn't work. Now it looks like it's working for methods like the one above. But it doesn't work for something like:

          preApprovalRequestRepository.findAll(current().and(createdBy(auth.getName())), pageRequest))

          . That's a method using QueryDsl predicates. It looks like it's adding the order by clause (and paging), but ignores the ignoreCase flag for such methods.

          Show
          Iulian Stefanica added a comment - OK, it was there, I figured out why (or more precise what/when) it doesn't work. Now it looks like it's working for methods like the one above. But it doesn't work for something like: preApprovalRequestRepository.findAll(current().and(createdBy(auth.getName())), pageRequest)) . That's a method using QueryDsl predicates. It looks like it's adding the order by clause (and paging), but ignores the ignoreCase flag for such methods.
          Hide
          Oliver Gierke added a comment -

          We missed updating the Querydsl integration. That should be fixed by now. CI build should populate the snapshot repo in a few minutes.

          Show
          Oliver Gierke added a comment - We missed updating the Querydsl integration. That should be fixed by now. CI build should populate the snapshot repo in a few minutes.
          Hide
          Iulian Stefanica added a comment -

          Sorry for the late reply, took a while to go through the full testing process. Yes, case insensitive sorting seems to work fine now. Thanks mate, really appreciate the fast turnaround!

          Show
          Iulian Stefanica added a comment - Sorry for the late reply, took a while to go through the full testing process. Yes, case insensitive sorting seems to work fine now. Thanks mate, really appreciate the fast turnaround!

            People

            • Assignee:
              Oliver Gierke
              Reporter:
              Kevin Raymond
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: