title: How to implement multiple inner join in Hibernate
body: <p>product_template, product_account, product_style and product_account are tables.
  mysql command:</p>
  
  <pre><code>select distinct product_template.id as ptid from product_account inner join product on product_account.productId=product.id inner join product_style on product.productStyleId=product_style.id inner join product_template on product_style.productTemplateId=product_template.id where product_account.sellerId=1 and product_account.productAccountType=1;
  </code></pre>
  
  <p>Mysql command is working fine but I don't know how to implement in criteria.<br>
  My code:</p>
  
  <pre><code>Criteria c = createCriteria(ProductAccount.class);
  ProjectionList projectionList = Projections.projectionList();
  c.add(Restrictions.eq("seller", query.getSeller()));
  c.add(Restrictions.eq("productAccountType", query.getProductAccountType()));
  c.createCriteria("product").createCriteria("productStyle").createCriteria("productTemplate");
  c.setProjection(Projections.distinct(Projections.property("id")));
  List&lt;Object&gt; objects = c.list();
  </code></pre>
  
  <p>Iam getting only id's of product_account but I need id's of product_template. Any would be appreciated. Thanks in advance.</p>