title: Joining multiple table using hibernate criteria
body: <p>I am trying to join multiple table to join using criteria but getting some problem , please help me:
  I have a sql query like :</p>
  
  <pre><code>SELECT  a.type, a.time, c.code AS exchangeCode
   FROM   CutOffTime AS a INNER JOIN
         Country AS b ON a.country_fk = b.id INNER JOIN
         Exchange AS c ON c.country_fk = b.id
  </code></pre>
  
  <p>These three table : CutOffTime (has country), Country, Exchange (has country) are 3 entity classes.</p>
  
  <p>How can i join like this using hibernate criteria,my code below still not complete :</p>
  
  <pre><code> List&lt;Map&lt;String, Object&gt;&gt; aa= ( List&lt;Map&lt;String, Object&gt;&gt;) getHibernateTemplate().executeFind(new HibernateCallback() {
              @Override
              public Object doInHibernate(final Session session) throws HibernateException, SQLException {
                  final Criteria c = session.createCriteria(CutOffTime.class,"cutofftime");
                  c.createAlias("cutofftime.country", "country");
  
                  final Criteria c2= session.createCriteria(Exchange.class,"exchange");
                  c2.createAlias("exchange.country", "country");
  //              c.add(Restrictions.eqProperty("cutofftime.country.id","exchange.country.id"));
                  return c.list();
              }
          });
  </code></pre>