title: Hibernate criteria -- alias
body: <p>I'm struggling a bit with the concept of alias in Hibernate.<br>
  My situation is the following:<br>
  <strong>Order</strong></p>
  
  <pre><code>@OneToMany(cascade=CascadeType.ALL,mappedBy="m_order")
  private Set&lt;OrderDetail&gt; m_details; 
  </code></pre>
  
  <p><strong>OrderDetail</strong></p>
  
  <pre><code>    @ManyToOne(cascade=CascadeType.ALL)
      @JoinColumn(name="product_id")
      private Product m_product;
      @ManyToOne(cascade=CascadeType.ALL)
      @JoinColumn(name="order_id")
      private Order m_order;
  </code></pre>
  
  <p><strong>DAO</strong></p>
  
  <pre><code>c.createAlias("m_details", "detail").createCriteria("detail.m_product").add(Expression.idEq(productId));
  </code></pre>
  
  <p>So I want to search every order that contains a product.<br>
  However, with this query it keeps returning 0 orders and I don't really see what I'm doing wrong.<br>
  Thanks!</p>