title: JPA CriteriaQuery OneToMany
body: <p>I have two entities with a OneToMany relationship. To make it simple, let's suppose them as School and Students, with a unidirectional relationship from school to students. I want to find the school object that has a specific student (a student with a specific age, name, ssn, ...).
  I know that I can create a simple criteria as the following for simple School's properties (for School's name, as the following):</p>
  
  <pre><code>ParameterExpression&lt;String&gt; p = criteriaBuilder.parameter(String.class, "schoolName");
              criteria = criteriaBuilder.and(criteria, criteriaBuilder.like(schoolRoot.get("schoolName") , p));
  queryResult.setParameter("schoolName", schoolName + "%");
  </code></pre>
  
  <p>but, how can I query students with a specific property value while the students is represented as a <code>java.util.List</code> instead of being a basic property?</p>
  
  <p>Can somebody can help me figure this out? I hope I have been able to explain my problem.</p>
  
  <p>Thanks</p>