title: getting this error : illegal attempt to dereference collection [{synthetic-alias}{non-qualified-property-ref}gcmUsers]
body: <p>i have 2 table  GcmUser  and   GroupName in many to many  relation in hibernate .</p>
  
  <p>my query is :</p>
  
  <pre><code>from GcmUser
  where clientName='admin'
  and  id IN
  (
      SELECT id
      FROM GroupName
      WHERE id =
          (
              SELECT id
              FROM GroupName
              WHERE groupName = 'Multy'
              AND gcmUsers.userName ='niraj'
          )
  )
  order by createdDateTime asc
  </code></pre>
  
  <p>and I got the error: <code>illegal attempt to dereference collection [{synthetic-alias}{non-qualified-property-ref}gcmUsers] with element property reference [userName]</code></p>
  
  <p>full stack trace:</p>
  
  <pre><code>org.hibernate.QueryException: illegal attempt to dereference collection [{synthetic-alias}{non-qualified-property-ref}gcmUsers] with element property reference [userName] [select count(*) as totalcount  from com.bonrix.gcm.demo.model.GcmUser where clientName='admin'and  id IN(SELECT id FROM com.bonrix.gcm.demo.model.GroupName WHERE id =(SELECT id FROM com.bonrix.gcm.demo.model.GroupName WHERE groupName = 'Multy' AND gcmUsers.userName ='gadia'))]
      at org.hibernate.hql.internal.ast.tree.DotNode$1.buildIllegalCollectionDereferenceException(DotNode.java:68)
      at org.hibernate.hql.internal.ast.tree.DotNode.checkLhsIsNotCollection(DotNode.java:550)
      at org.hibernate.hql.internal.ast.tree.DotNode.resolve(DotNode.java:246)
      at org.hibernate.hql.internal.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:118)
      at org.hibernate.hql.internal.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:114)
      at org.hibernate.hql.internal.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:881)
      at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1264)
      at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4297)
      at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3769)
      at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1947)
  </code></pre>
  
  <p>i can not understand the meaning of the error .and why it comes?????</p>