0 Replies Latest reply on Nov 27, 2007 12:01 PM by Alex Grönholm

    Query won't parse, why?

    Alex Grönholm Novice

      I have the following named query:

      @NamedQuery(name = SalesOrderExtraChargeLine.QUERY_UNBILLED_DATERANGE, query =
      "SELECT el FROM SalesOrderExtraChargeLine el WHERE el.order.orderDate >= :startDate AND el.order.orderDate <= :endDate AND el.invoiceLines IS EMPTY AND NOT EXISTS (SELECT pl FROM SalesOrderProductLine pl WHERE pl.order = el.order AND pl.status <> :deliveredStatus)")
      

      When I deploy the app, I get the following error:
      17:57:06,287 WARN [ServiceController] Problem starting service persistence.units:ear=Etikettu.ear,jar=Etikettu-EJB.jar,unitName=etikettu
      java.lang.NullPointerException
       at org.hibernate.hql.ast.tree.FromClause.findIntendedAliasedFromElementBasedOnCrazyJPARequirements(FromClause.java:120)
       at org.hibernate.hql.ast.tree.FromClause.getFromElement(FromClause.java:107)
       at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:81)
       at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70)
       at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:255)
       at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3056)
       at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
       at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
       at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
       at org.hibernate.hql.antlr.HqlSqlBaseWalker.collectionFunctionOrSubselect(HqlSqlBaseWalker.java:4253)
       at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3968)
       at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1762)
       at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1737)
       at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1690)
       at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
       at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
       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:228)
       at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
       at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
       at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
      ...
      

      SalesOrderProductLine and SalesOrderExtraChargeLine are both inherited from the same base entity (SalesOrderLine) using "JOINED" inheritance.
      What am I doing wrong?