title: unexpected AST Node
body: <p>I use the below given HQL Query:</p>
  
  <pre><code>select A.id.customerName,
         A.id.customerId,
         A.id.IZone,
         B.id.accountType,
         B.id.accountNumber,
         B.id.bankBranch,
         (DAYS(current_date)-DAYS(B.id.enrolledDate)) -
         (select count(distinct C.id.DWkhol) from Holiday C
          where C.id.ICo='01' and
                C.id.DWkhol between B.id.enrolledDate and current_date)
  from Profile A, Account B
  where B.id.accountNumber != ' ' and
        A.id.customerId= B.id.customerId;
  </code></pre>
  
  <p>Same query works fine in SQL developer and i am able to see the values. 
  But I am receiving expections when i call this Query through my java class:</p>
  
  <blockquote>
    <p>[3/16/17 21:02:29:624 EDT] 00000027 SystemOut     O 406868
    [WebContainer : 1] ERROR org.hibernate.hql.PARSER  - :0:0:
    unexpected AST node: query [3/16/17 21:02:29:626 EDT] 00000027
    SystemOut     O 406868 [WebContainer : 1] DEBUG
    org.hibernate.hql.ast.ErrorCounter  - :0:0: unexpected AST node:
    query :0:0: unexpected AST node: query   at
    org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1312)
      at
    org.hibernate.hql.antlr.HqlSqlBaseWalker.arithmeticExpr(HqlSqlBaseWalker.java:2749)
      at
    org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:2006)
      at
    org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:1825)
      at
    org.hibernate.hql.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1394)
      at
    org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:553)
      at
    org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
      at
    org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
      at
    org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:251)
      at
    org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183)
      at
    org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:13
    [3/16/17 21:02:29:626 EDT] 00000027 SystemOut     O 406870
    [WebContainer : 1] ERROR org.hibernate.hql.PARSER  -  right-hand
    operand of a binary operator was null [3/16/17 21:02:29:627 EDT]
    00000027 SystemOut     O 406870 [WebContainer : 1] DEBUG
    org.hibernate.hql.ast.ErrorCounter  -  right-hand operand of a binary
    operator was null  right-hand operand of a binary operator was null
      at
    org.hibernate.hql.ast.tree.BinaryArithmeticOperatorNode.initialize(BinaryArithmeticOperatorNode.java:48)
      at
    org.hibernate.hql.ast.HqlSqlWalker.prepareArithmeticOperator(HqlSqlWalker.java:1033)
      at
    org.hibernate.hql.antlr.HqlSqlBaseWalker.arithmeticExpr(HqlSqlBaseWalker.java:2756)
      at
    org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:2006)
      at
    org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:1825)
      at
    org.hibernate.hql.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1394)
      at
    org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:553)
      at
    org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
      at
    org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
      at
    org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:251)
      at
    org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183)
      at
    org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:134)</p>
  </blockquote>