java.lang.NullPointerException

Hibernate JIRA | tenwit | 10 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    I'm using a simple named query to search for all objects that have a given value-element in a set. It works if I alias the object, but not if I don't. In the code below, query OrganisationsByType1 produces the given exception, OrganisationsByType2 works perfectly. Mapping documents:<pre> <class name="OrganisationImpl" table="Organisation"> ... <set name="Types" table="OrganisationTypeLink" lazy="true" cascade="all"> <key column="OrganisationID"/> <element column="OrganisationTypeID" not-null="true" type="OrganisationType"/> </set> </class> <query name="OrganisationsByType1"> from OrganisationImpl where :Type in elements(Types) </query> <query name="OrganisationsByType2"> from OrganisationImpl o where :Type in elements(o.Types) </query> </pre> Full stack trace of any exception that occurs: <pre>java.lang.NullPointerException at org.hibernate.hql.ast.MethodNode.handleElements(MethodNode.java:154) at org.hibernate.hql.ast.MethodNode.resolveCollectionProperty(MethodNode.java:105) at org.hibernate.hql.ast.CollectionFunction.resolve(CollectionFunction.java:22) at org.hibernate.hql.ast.HqlSqlWalker.processFunction(HqlSqlWalker.java:538) at org.hibernate.hql.antlr.HqlSqlBaseWalker.collectionFunction(HqlSqlBaseWalker.java:2273) at org.hibernate.hql.antlr.HqlSqlBaseWalker.collectionFunctionOrSubselect(HqlSqlBaseWalker.java:3937) at org.hibernate.hql.antlr.HqlSqlBaseWalker.inRhs(HqlSqlBaseWalker.java:3854) at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3517) at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1405) at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1333) at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:599) at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:404) at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201) at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83) at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427) at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:388) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:291) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005) </pre>...

    Hibernate JIRA | 10 years ago | tenwit
    java.lang.NullPointerException
  2. 0

    I'm using a simple named query to search for all objects that have a given value-element in a set. It works if I alias the object, but not if I don't. In the code below, query OrganisationsByType1 produces the given exception, OrganisationsByType2 works perfectly. Mapping documents:<pre> <class name="OrganisationImpl" table="Organisation"> ... <set name="Types" table="OrganisationTypeLink" lazy="true" cascade="all"> <key column="OrganisationID"/> <element column="OrganisationTypeID" not-null="true" type="OrganisationType"/> </set> </class> <query name="OrganisationsByType1"> from OrganisationImpl where :Type in elements(Types) </query> <query name="OrganisationsByType2"> from OrganisationImpl o where :Type in elements(o.Types) </query> </pre> Full stack trace of any exception that occurs: <pre>java.lang.NullPointerException at org.hibernate.hql.ast.MethodNode.handleElements(MethodNode.java:154) at org.hibernate.hql.ast.MethodNode.resolveCollectionProperty(MethodNode.java:105) at org.hibernate.hql.ast.CollectionFunction.resolve(CollectionFunction.java:22) at org.hibernate.hql.ast.HqlSqlWalker.processFunction(HqlSqlWalker.java:538) at org.hibernate.hql.antlr.HqlSqlBaseWalker.collectionFunction(HqlSqlBaseWalker.java:2273) at org.hibernate.hql.antlr.HqlSqlBaseWalker.collectionFunctionOrSubselect(HqlSqlBaseWalker.java:3937) at org.hibernate.hql.antlr.HqlSqlBaseWalker.inRhs(HqlSqlBaseWalker.java:3854) at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3517) at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1405) at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1333) at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:599) at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:404) at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201) at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83) at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427) at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:388) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:291) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005) </pre>...

    Hibernate JIRA | 10 years ago | tenwit
    java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.hibernate.hql.ast.MethodNode.handleElements()
    2. Hibernate HQL/JP-QL Parser
      HqlSqlWalker.processFunction
      1. org.hibernate.hql.ast.MethodNode.handleElements(MethodNode.java:154)
      2. org.hibernate.hql.ast.MethodNode.resolveCollectionProperty(MethodNode.java:105)
      3. org.hibernate.hql.ast.CollectionFunction.resolve(CollectionFunction.java:22)
      4. org.hibernate.hql.ast.HqlSqlWalker.processFunction(HqlSqlWalker.java:538)
      4 frames
    3. Hibernate
      HqlSqlBaseWalker.statement
      1. org.hibernate.hql.antlr.HqlSqlBaseWalker.collectionFunction(HqlSqlBaseWalker.java:2273)
      2. org.hibernate.hql.antlr.HqlSqlBaseWalker.collectionFunctionOrSubselect(HqlSqlBaseWalker.java:3937)
      3. org.hibernate.hql.antlr.HqlSqlBaseWalker.inRhs(HqlSqlBaseWalker.java:3854)
      4. org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3517)
      5. org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1405)
      6. org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1333)
      7. org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:599)
      8. org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:404)
      9. org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201)
      10. org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151)
      10 frames
    4. Hibernate HQL/JP-QL Parser
      QueryTranslatorImpl.compile
      1. org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
      2. org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
      3. org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
      3 frames
    5. Hibernate
      SessionFactoryImpl.<init>
      1. org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
      2. org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:388)
      3. org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:291)
      3 frames
    6. Hibernate
      Configuration.buildSessionFactory
      1. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005)
      1 frame