title: ElementCollection createAlias in hibernate API
body: <p>does anyone know if and how the solution for <a href="https://stackoverflow.com/questions/2735071/hibernate-criteria-api-adding-a-criterion-string-should-be-in-collection">following question</a> (which is written in the JPA API) can be written using the hibernate criteria API?</p>
  
  <p>To be more specific I have a Discussion entity that contains a list of participants (which is a list of usernames):</p>
  
  <pre><code>@ElementCollection
  @Column(name = "user_name")
  @CollectionTable(name = "DISCUSSION_USER", joinColumns = @JoinColumn(name = "DISCUSSION_ID"))
  @OrderColumn(name = "ORDER_INDEX")
  private List&lt;String&gt; participants = new ArrayList&lt;String&gt;();
  </code></pre>
  
  <p>Now I need to retrieve all Discussions where a given username is a participant.</p>
  
  <p>If I would have created an entity for Participant this would be straightforward:</p>
  
  <pre><code>    Criteria crit = getSession().createCriteria(Discussion.class);
      crit.createAlias("participants", "p");
      crit.add(Restrictions.eq("p.userName", portalUsername));
  </code></pre>
  
  <p>But I can't create an alias with a non entity...</p>