title: Spring data JPA query with parameter properties
body: <p>What is the simplest way of declaring a Spring data JPA query that uses properties of an input parameter as query parameters?</p>
  
  <p>For example, suppose I have an entity class:</p>
  
  <pre><code>public class Person {
      @Id
      private long id;
  
      @Column
      private String forename;
  
      @Column
      private String surname;
  }
  </code></pre>
  
  <p>and another class:</p>
  
  <pre><code>public class Name {
      private String forename;
      private String surname;
  
      [constructor and getters]
  }
  </code></pre>
  
  <p>... then I would like to write a Spring data repository as follows:</p>
  
  <pre><code>public interface PersonRepository extends CrudRepository&lt;Person, Long&gt; {
      @Query("select p from Person p where p.forename = ?1.forename and p.surname = ?1.surname")
      findByName(Name name);
  }
  </code></pre>
  
  <p>... but Spring data / JPA doesn't like me specifying property names on the <code>?1</code> parameter.</p>
  
  <p>What is the neatest alternative?</p>