title: Hibernate criteria query for multiple ON condition while joining
body: <p>My query is as below:</p>
  
  <pre><code>select a_.*
  from table1 a_ inner join table2 b_
  on a_.id = b_.id and a_.id2=b_.id2
  where b_.name = 'XYZ';
  </code></pre>
  
  <p>I tried criteria as below for the query:</p>
  
  <pre><code>Criteria crt = sessionFactory.getCurrentSession().createCriteria(ABC.class,"a")
           .createAlias("a.id","b",JoinType.INNER_JOIN)
           .add(Restrictions.eq("a.id2", "b.id2"));
  crt.add(Restrictions.eq("b.name","XYZ"));
  </code></pre>
  
  <p>But it converts into :</p>
  
  <pre><code>select this_.*
  from table1 this_ inner join table2 b_ on this_.id=b_.id
  where this_.id2=? and b_.name=?
  </code></pre>
  
  <p>and gives null result. That is because , b_.name is "XYZ" but for this_.id2 I dont have any value specifically (i.e the value from other table).
  How to write criteria query for multiple conditions in ON.</p>