title: Adding where condition on Parent Object when child object is root. JPA Criteria API
body: <p>I have below method which prepares where condition for my query. 
  I want to add where condition on Parent object, and child object is my Root.</p>
  
  <p>How do I achieve this using JPA Criteria API. </p>
  
  <p>Below is my existing code, currently the where condition on parent object is commented out. </p>
  
  <pre><code> private void prepareSearchCriteria(
    Map&lt;String, Object&gt; filters,
    CriteriaBuilder builder,
    Root&lt;Employee&gt; employee,
    List&lt;Predicate&gt; predicates) {
  
  if (filters.containsKey("employeeName")) {
    predicates.add(builder.equal(employee.get("employeeName"),filters.get("employeeName").toString()));
  }
  
  if (filters.containsKey("enp.deptName")) {
    // How do add this condition ?
    // predicates.add(builder.equal(employee.get("employeeName"),filters.get("enp.deptName").toString()));
  }
  
  }
  </code></pre>
  
  <p>Can anybody help me with this? I am new to JPA Criteria API. </p>