Details

      Description

          @Query("SELECT c.name AS n FROM cats c")
          List<String> findCats(Sort sort);
      ...
          findCats(new Sort("n"));
      

      doesn't work ("The state field path 'c.n' cannot be resolved to a valid type."). Although

          @Query("SELECT lower(c.name) AS n FROM cats c")
          List<String> findCats(Sort sort);
      ...
          findCats(new Sort("n"));
      

      works fine.

      http://docs.spring.io/spring-data/jpa/docs/1.11.x/reference/html/#jpa.query-methods.sorting
      says: The properties actually used within the Order instances of Sort need to match to your domain model, which means they need to resolve to either a property or an alias used within the query.

        Attachments

          Activity

            People

            • Assignee:
              schauder Jens Schauder
              Reporter:
              skrser Sergey Skryabin
              Last updater:
              Mark Paluch
            • Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: