title: hibernate criteria if collection contains collection
body: <p>I have a Priv class</p>
  
  <pre><code>@Entity
  @Table(name = "PK_PRIVS", schema = "dbo")
  public class Priv implements java.io.Serializable{
  
  private static final long serialVersionUID = 1L;
  private String code;
  private String name;
  private String description;
  private PrivType type;
  //...
  } 
  </code></pre>
  
  <p>and a Report class which has many to many relation with Priv and contains Set of associated Privs - privs.</p>
  
  <pre><code>@Entity
  @Table(name = "REPORT", schema = "dbo")
  public class Report implements java.io.Serializable {
  
  //...
  
  private Set&lt;Priv&gt; privs = new HashSet&lt;Priv&gt;(0);
  
  //...
  
  @JsonIgnore
  @ManyToMany(fetch = FetchType.LAZY)
  @JoinTable(name = "REPORT_PK_PRIVS", schema = "dbo", joinColumns = { @JoinColumn(name = "REPORT_ID") }, inverseJoinColumns = { @JoinColumn(name = "PK_PRIVS_CODE") })
  public Set&lt;Priv&gt; getPrivs() {
      return this.privs;
  }
  
  public void setPrivs(Set&lt;Priv&gt; privs) {
      this.privs = privs;
  }
  
  
  
  }
  </code></pre>
  
  <p>Now I have a Set of Strings, which are codes of Priv classes (code is Primary Key in Priv).</p>
  
  <pre><code>Set&lt;String&gt; privsCodesSet; //set of codes of Priv classes
  </code></pre>
  
  <p>I need a criterion which allow me to find that Reports, which all codes from its Priv set contains in privsCodesSet. For example if I have privsCodeSet = {"code1", "code2"}</p>
  
  <p>Report with privs with codes {"code1"" should be in result, but
  Report with privs with codes {"code1", "code2", "code3"} should not.</p>
  
  <p>I also have class which is join of Priv and Report, but I'm not sure if it's help.</p>