title: Spring data, find by property of a nested object
body: <p>I have the following code:</p>
  
  <pre><code>@Entity
  public class StudentEntity {
      @Id
      private String id;
      private Student student;
      ...
  }
  
  
  public class Student {
      private String name;
      private List&lt;Grade&gt; grades;
  }
  
  
  public class Grade {
      private String className;
      private String grade;
  }
  </code></pre>
  
  <p>I've set up a spring data mongodb repository and I'm trying to create a method that will return me a <code>List&lt;Student&gt;</code> based on a <code>className</code> that I pass in as parameter. Based on everything I've read, I assumed that the following would work:</p>
  
  <pre><code>public List&lt;Student&gt; findByStudentGradesClassName(final String className);
  </code></pre>
  
  <p>but that gives an error saying that the parameter type should be a <code>Grade</code> object. I really only want to pass in a <code>String className</code>.</p>
  
  <p>Is this possible?</p>