title: How to use hibernate search criteria on parameter with set
body: <p>I have several entities where one of them has a parameter with Set containing other entities from many-to-many join like this (I am using only two of them for simplicity).
  How can I use search criteria to filter out Users who have Avatar with id==1?</p>
  
  <pre><code>@Entity
  public class User
  {
      @Id
      private String loginId;
      private String screenName;
      @ManyToMany(mappedBy = "user")
      private Set&lt;Avatar&gt; avatars;
  }
  
  @Entity
  public class Avatar
  {
      @Id
      private Integer id;
      @ManyToMany
      @JoinTable(
          name = "user",
          joinColumns = @JoinColumn(name = "id"),
          inverseJoinColumns = @JoinColumn(name = "loginId"))
      private User user;
      private String url;
  }
  </code></pre>