title: org.hibernate.QueryException: illegal attempt to dereference collection
body: <p>I am trying following hql query to execute</p>
  
  <pre><code>SELECT count(*) 
    FROM BillDetails as bd
   WHERE bd.billProductSet.product.id = 1002
     AND bd.client.id                 = 1
  </code></pre>
  
  <p>But it is showing </p>
  
  <pre><code>org.hibernate.QueryException: illegal attempt to dereference collection 
  [billdetail0_.bill_no.billProductSet] with element property reference [product] 
  [select count(*) from iland.hbm.BillDetails as bd where bd.billProductSet.product.id=1001 and bd.client.id=1]
      at org.hibernate.hql.ast.tree.DotNode$1.buildIllegalCollectionDereferenceException(DotNode.java:68)
      at org.hibernate.hql.ast.tree.DotNode.checkLhsIsNotCollection(DotNode.java:558)
  </code></pre>