title: HIbernate HQL unexpected token
body: <p>I have following Hibernate query:</p>
  
  <pre><code>String HSQL = "from Page as p "
    + "where not exists (from Link as l where l.dealId = p.id) "
    + "and p.userId = :userId";
  
  return (List&lt;Deal&gt;) sessionFactory.getCurrentSession()
    .createQuery(HSQL)
    .setParameter("userId", userId)
    .list();
  </code></pre>
  
  <p>But on method <code>.createQuery(HSQL)</code> it fails with following exception</p>
  
  <pre><code>[ ERROR ] [12.11.2019 13:19:10] --- U: I: S: --- org.hibernate.hql.internal.ast.ErrorTracker: line 1:137: unexpected token: .
  [ ERROR ] [12.11.2019 13:19:10] --- U: I: S: --- org.hibernate.hql.internal.ast.ErrorTracker: line 1:137: unexpected token: .
  antlr.NoViableAltException: unexpected token: .
      at org.hibernate.hql.internal.antlr.HqlBaseParser.fromClassOrOuterQueryPath(HqlBaseParser.java:1972) [hibernate-core-5.4.1.Final.jar:5.4.1.Final]
      at org.hibernate.hql.internal.antlr.HqlBaseParser.fromRange(HqlBaseParser.java:1499) [hibernate-core-5.4.1.Final.jar:5.4.1.Final]
      at org.hibernate.hql.internal.antlr.HqlBaseParser.fromClause(HqlBaseParser.java:1343) [hibernate-core-5.4.1.Final.jar:5.4.1.Final]
      at org.hibernate.hql.internal.antlr.HqlBaseParser.selectFrom(HqlBaseParser.java:1063) [hibernate-core-5.4.1.Final.jar:5.4.1.Final]
      at org.hibernate.hql.internal.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:748) [hibernate-core-5.4.1.Final.jar:5.4.1.Final]
      at org.hibernate.hql.internal.antlr.HqlBaseParser.subQuery(HqlBaseParser.java:3910) [hibernate-core-5.4.1.Final.jar:5.4.1.Final]
      at org.hibernate.hql.internal.antlr.HqlBaseParser.quantifiedExpression(HqlBaseParser.java:3515) [hibernate-core-5.4.1.Final.jar:5.4.1.Final]
      at org.hibernate.hql.internal.antlr.HqlBaseParser.unaryExpression(HqlBaseParser.java:3373) [hibernate-core-5.4.1.Final.jar:5.4.1.Final]
      at org.hibernate.hql.internal.antlr.HqlBaseParser.multiplyExpression(HqlBaseParser.java:3273) [hibernate-core-5.4.1.Final.jar:5.4.1.Final]
  ...
  </code></pre>
  
  <p>My version of Hibernate is 5.4.1.</p>
  
  <p>What is wrong with the query?</p>