title: Hibernate Criteria API: Joining tables with custom join
body: <p>I am asking myself if following query can be mapped by Hibernate Criteria API</p>
  
  <pre><code>SELECT * FROM table_a as a LEFT OUTER JOIN table_b as b ON a.primary_key = b.foreign_key and b.any_column = 'my_value'
  </code></pre>
  
  <p>Ok, everything except <code>and b.any_column = 'my_value'</code> is not difficult for me. Either using FetchMode.JOIN or addCriteria(...,...).</p>
  
  <p>But the  <code>and b.any_column = 'my_value'</code> is producing headaches.</p>
  
  <p>I have tried with embedding:</p>
  
  <pre><code>addCriteria("b", Criteria.LEFT_JOIN).add(Restriction.eq("b.any_column", my_value))
  </code></pre>
  
  <p>But this is producing:</p>
  
  <pre><code>SELECT * FROM table_a as a LEFT OUTER JOIN table_b as b ON a.primary_key = b.foreign_key WHERE b.any_column = 'my_value'
  </code></pre>
  
  <p>This is not my purpose and is of course producing different results then my expected query. Can anybody give me a hint how I can tell Hibernate to map to the desired query?</p>
  
  <p>Thanks,
  Michael</p>