Write queryDSL predicate query for oneTomany relation based query
<p>I am using spring-data, QueryDSL and MySQL.</p>

<p>Main aim of question is to know how to do a such a query in queryDSL way. Given example is just a simple example to give idea.</p>

<p>Say for example, there are two tables Employee and Certificate. Relation between two is ONE (Employee) to MANY (Certificate)</p>

<p>Following are tables,</p>

<pre><code>Employee (id, first_name, last_name);
Certificate (id, name, date, fk_emp);
</code></pre>

<p>What should be the QueryDSL predicate for</p>

<blockquote>
  <p>Returning all employees with name contains (in first_name and last_name) and from that result whose certification between date 22-12-2014 to 22-12-2015</p>
</blockquote>

<p>I tried it but could not get how I can iterate over each certificate of each employee in QueryDSL way and return list of employees.</p>

<p>Your response will be highly appreciated !!</p>

<p><strong>EDIT</strong></p>

<p>Following are the entities,</p>

<pre><code>@Entity
@Table(name = "EMPLOYEE")
class Employee {
  @Id
  @Column(name = "ID")
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Integer id;

  @Column(name = "FIRST_NAME")
  private String firstName;

  @Column(name = "LAST_NAME")
  private String lastName;

  @OneToMany(mappedBy = "employee", cascade = CascadeType.ALL)
  private List&lt;Certificate&gt; certificates = new ArrayList&lt;&gt;();
}

@Entity
@Table(name = "CERTIFICATE")
class Certificate {
  @Id
  @Column(name = "ID")
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Integer id;

  @Column(name = "CERTIFICATE_NAME")
  private String certificateName;

  @Column(name = "DATE")
  private Date date;

  @ManyToOne
  @JoinColumn(name = "REF_EMPLOYEE")
  private Employee employee;
}
</code></pre>