Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-5555

NullPointerException at org.hibernate.hql.internal.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:393)

    Details

      Description

      A query

      SELECT pr FROM ProductRelease pr LEFT JOIN pr.line pl ORDER BY pl.name
      

      on a simple entity in other entity causes a NPEx:

      Caused by: java.lang.NullPointerException
      	at org.hibernate.hql.internal.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:393) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3516) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3302) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3180) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:706) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:562) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:299) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:247) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:248) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:105) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:219) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:197) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1736) [hibernate-core-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:291) [hibernate-entitymanager-4.1.5.SP1.jar:4.1.5.SP1]
      	at org.jboss.as.jpa.container.AbstractEntityManager.createQuery(AbstractEntityManager.java:425) [jboss-as-jpa-7.1.2.Final.jar:7.1.2.Final]
      

      I'm filling this here since in Hibernate jira NPEx are (or used to be FWIR) ignored, whereas for AS 7 / EAP 6 we agreed that NPEx is not a good way to let user know that something's wrong. In this case, it's missing N:1 mapping annotation.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                smarlow Scott Marlow
                Reporter:
                ozizka Ondrej Zizka
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: