title: Select only JPA Collection members meeting condition
body: <p>I'm trying to select entries for Entity A where <strong>all</strong> of the children in its collection of CReference entities meet a condition.  The query I currently have only requires the conditions to be met on at least one of the members.</p>
  
  <h1>Current Query</h1>
  
  <p>This query currently selects all objects of type A where at least one of the items in its c_references class </p>
  
  <p><pre><code>SELECT a FROM A a INNER JOIN FETCH a.c_references c_refs INNER JOIN FETCH c_refs.c_reference c_ref WHERE (c_ref.flag_one=TRUE AND c_ref.flag_two=TRUE)</pre></code></p>
  
  <h1>Classes</h1>
  
  <h2>Class A</h2>
  
  <p><pre><code>
  @Entity
  public class A{</p>
  
  <pre><code>@Id
  private UUID a_uuid;
  
  @OneToMany(fetch = FetchType.EAGER)
  @JoinColumn(name = "owning_a_uuid")
  private List&lt;CReference&gt; c_references;
  </code></pre>
  
  <p>}
  </pre></code></p>
  
  <h2>Class CReference</h2>
  
  <p><pre><code>
  @Entity
  // This class keeps references to all of the A objects that have referenced a C object
  public class CReference{</p>
  
  <pre><code>@Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private long c_reference_id;
  
  @OneToOne
  private A a_referencing_c;
  
  @OneToOne
  private C c_reference;
  </code></pre>
  
  <p>}
  </pre></code></p>
  
  <h2>Class C</h2>
  
  <p><pre><code>
  @Entity
  @Cacheable
  public class C{</p>
  
  <pre><code>@Id
  private UUID c_uuid;
  
  private Boolean flag_one = false;
  
  private Boolean flag_two = false;
  </code></pre>
  
  <p>}
  </pre></code></p>