title: Spring Data Rest - sort by nested property
body: <p>I have a database service using Spring Boot 1.5.1 and Spring Data Rest. I am storing my entities in a MySQL database, and accessing them over REST using Spring's PagingAndSortingRepository. I found <a href="https://github.com/spring-projects/spring-data-rest/blob/master/src/main/asciidoc/paging-and-sorting.adoc" rel="noreferrer">this</a> which states that sorting by nested parameters is supported, but I cannot find a way to sort by nested fields.</p>
  
  <p>I have these classes:</p>
  
  <pre><code>@Entity(name = "Person")
  @Table(name = "PERSON")
  public class Person {
      @ManyToOne
      protected Address address;
  
      @ManyToOne(targetEntity = Name.class, cascade = {
          CascadeType.ALL
      })
      @JoinColumn(name = "NAME_PERSON_ID")
      protected Name name;
  
      @Id
      protected Long id;
  
      // Setter, getters, etc.
  }
  
  @Entity(name = "Name")
  @Table(name = "NAME")
  public class Name{
  
      protected String firstName;
  
      protected String lastName;
  
      @Id
      protected Long id;
  
      // Setter, getters, etc.
  }
  </code></pre>
  
  <p>For example, when using the method:</p>
  
  <pre><code>Page&lt;Person&gt; findByAddress_Id(@Param("id") String id, Pageable pageable);
  </code></pre>
  
  <p>And calling the URI <i><a href="http://localhost:8080/people/search/findByAddress_Id?id=1&amp;sort=name_lastName,desc" rel="noreferrer">http://localhost:8080/people/search/findByAddress_Id?id=1&amp;sort=name_lastName,desc</a></i>, the sort parameter is completely ignored by Spring.</p>
  
  <p>The parameters <i>sort=name.lastName</i> and <i>sort=nameLastName</i> did not work either.</p>
  
  <p>Am I forming the Rest request wrong, or missing some configuration?</p>
  
  <p>Thank you!</p>