title: Criteria API filter by properties of different children
body: <p>What is the better approach to get a Parent with at least one Sub with the name 'A' and at least one Sub with the name 'B' at the same time?</p>
  <p>I have to use Criteria API to solve the problem.</p>
  <p>I have such kind of entities with Many-To-Many relationship (some code omitted):</p>
  <pre><code>class Parent {
      Long id;
  
      @ManyToMany
      List&lt;Sub&gt; Subs
  
  }
  </code></pre>
  <pre><code>class Sub {
      Long id
  
      String name;
  
      @ManyToMany
      List&lt;Parent&gt; Parents
  }
  </code></pre>