java.lang.NullPointerException

Hibernate JIRA | finion | 4 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    The statement work fine on version 3.2.5, since upgrade to 3.2.7 it throw exception, and I try the latest 4.1.6 got the same problem. ---------------------------------------------------------- Exception in thread "main" java.lang.NullPointerException at org.hibernate.dialect.function.CastFunction.render(CastFunction.java:36) at org.hibernate.hql.ast.SqlGenerator.endFunctionTemplate(SqlGenerator.java:197) at org.hibernate.hql.antlr.SqlGeneratorBase.methodCall(SqlGeneratorBase.java:2223) at org.hibernate.hql.antlr.SqlGeneratorBase.selectExpr(SqlGeneratorBase.java:1897) at org.hibernate.hql.antlr.SqlGeneratorBase.selectColumn(SqlGeneratorBase.java:1743) at org.hibernate.hql.antlr.SqlGeneratorBase.selectClause(SqlGeneratorBase.java:527) at org.hibernate.hql.antlr.SqlGeneratorBase.selectStatement(SqlGeneratorBase.java:175) at org.hibernate.hql.antlr.SqlGeneratorBase.insertStatement(SqlGeneratorBase.java:444) at org.hibernate.hql.antlr.SqlGeneratorBase.statement(SqlGeneratorBase.java:137) at org.hibernate.hql.ast.exec.BasicExecutor.<init>(BasicExecutor.java:42) at org.hibernate.hql.ast.QueryTranslatorImpl.buildAppropriateStatementExecutor(QueryTranslatorImpl.java:535) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:178) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:113) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56) at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72) at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133) at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112) at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1624) at com.gss.lager.HibernateTest.main(HibernateTest.java:42) ------------------------------------------------------------------- sample code : StringBuffer incoming = new StringBuffer(); incoming.append("insert into DagEdgeImpl(entryEdgeId) ") .append("select edge.id ") .append("from DagEdgeImpl edge ") .append("where edge.endVertex.higherBits = ? ") .append("and edge.endVertex.lowerBits = ? "); log.debug("incoming sql : " + incoming); Query query = session.createQuery(incoming.toString()); query.setLong(0, -552857267868777299L); query.setLong(1, -5131265078905782943L); query.executeUpdate(); hbm : <hibernate-mapping package="com.gss.lager.texture.domain.impl"> <class name="DagEdgeImpl" table="LAGER_DAG_TC_EDGE"> <id name="id" column="id" type="long"> <generator class="native"> <param name="sequence">SEQ_DAG_TC_EDGE</param> </generator> </id> <version name="version" column="version" type="long"/> <property name="entryEdgeId" column="entry_edge_id" type="long" index="LAGER_DAG_ENTRY_EDGE_IDX"/> <property name="directEdgeId" column="direct_edge_id" type="long" index="LAGER_DAG_DIRECT_EDGE_IDX"/> <property name="exitEdgeId" column="exit_edge_id" type="long" index="LAGER_DAG_EXIT_EDGE_IDX"/> <property name="hops" column="hops" type="long" not-null="true" index="LAGER_DAG_HOPS"/> <property name="dagId" column="dag_id" type="string" not-null="true" index="LAGER_DAG_ID_IDX"/> <component name="startVertex" class="com.gss.lager.texture.domain.UUID"> <property name="higherBits" column="start_vertex_hi" index="LAGER_DAG_START_VTX_HI"/> <property name="lowerBits" column="start_vertex_lo" index="LAGER_DAG_START_VTX_LO"/> </component> <component name="endVertex" class="com.gss.lager.texture.domain.UUID"> <property name="higherBits" column="end_vertex_hi" index="LAGER_DAG_END_VTX_HI"/> <property name="lowerBits" column="end_vertex_lo" index="LAGER_DAG_END_VTX_LO"/> </component> </class> </hibernate-mapping>

    Hibernate JIRA | 4 years ago | finion
    java.lang.NullPointerException
  2. 0

    The statement work fine on version 3.2.5, since upgrade to 3.2.7 it throw exception, and I try the latest 4.1.6 got the same problem. ---------------------------------------------------------- Exception in thread "main" java.lang.NullPointerException at org.hibernate.dialect.function.CastFunction.render(CastFunction.java:36) at org.hibernate.hql.ast.SqlGenerator.endFunctionTemplate(SqlGenerator.java:197) at org.hibernate.hql.antlr.SqlGeneratorBase.methodCall(SqlGeneratorBase.java:2223) at org.hibernate.hql.antlr.SqlGeneratorBase.selectExpr(SqlGeneratorBase.java:1897) at org.hibernate.hql.antlr.SqlGeneratorBase.selectColumn(SqlGeneratorBase.java:1743) at org.hibernate.hql.antlr.SqlGeneratorBase.selectClause(SqlGeneratorBase.java:527) at org.hibernate.hql.antlr.SqlGeneratorBase.selectStatement(SqlGeneratorBase.java:175) at org.hibernate.hql.antlr.SqlGeneratorBase.insertStatement(SqlGeneratorBase.java:444) at org.hibernate.hql.antlr.SqlGeneratorBase.statement(SqlGeneratorBase.java:137) at org.hibernate.hql.ast.exec.BasicExecutor.<init>(BasicExecutor.java:42) at org.hibernate.hql.ast.QueryTranslatorImpl.buildAppropriateStatementExecutor(QueryTranslatorImpl.java:535) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:178) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:113) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56) at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72) at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133) at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112) at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1624) at com.gss.lager.HibernateTest.main(HibernateTest.java:42) ------------------------------------------------------------------- sample code : StringBuffer incoming = new StringBuffer(); incoming.append("insert into DagEdgeImpl(entryEdgeId) ") .append("select edge.id ") .append("from DagEdgeImpl edge ") .append("where edge.endVertex.higherBits = ? ") .append("and edge.endVertex.lowerBits = ? "); log.debug("incoming sql : " + incoming); Query query = session.createQuery(incoming.toString()); query.setLong(0, -552857267868777299L); query.setLong(1, -5131265078905782943L); query.executeUpdate(); hbm : <hibernate-mapping package="com.gss.lager.texture.domain.impl"> <class name="DagEdgeImpl" table="LAGER_DAG_TC_EDGE"> <id name="id" column="id" type="long"> <generator class="native"> <param name="sequence">SEQ_DAG_TC_EDGE</param> </generator> </id> <version name="version" column="version" type="long"/> <property name="entryEdgeId" column="entry_edge_id" type="long" index="LAGER_DAG_ENTRY_EDGE_IDX"/> <property name="directEdgeId" column="direct_edge_id" type="long" index="LAGER_DAG_DIRECT_EDGE_IDX"/> <property name="exitEdgeId" column="exit_edge_id" type="long" index="LAGER_DAG_EXIT_EDGE_IDX"/> <property name="hops" column="hops" type="long" not-null="true" index="LAGER_DAG_HOPS"/> <property name="dagId" column="dag_id" type="string" not-null="true" index="LAGER_DAG_ID_IDX"/> <component name="startVertex" class="com.gss.lager.texture.domain.UUID"> <property name="higherBits" column="start_vertex_hi" index="LAGER_DAG_START_VTX_HI"/> <property name="lowerBits" column="start_vertex_lo" index="LAGER_DAG_START_VTX_LO"/> </component> <component name="endVertex" class="com.gss.lager.texture.domain.UUID"> <property name="higherBits" column="end_vertex_hi" index="LAGER_DAG_END_VTX_HI"/> <property name="lowerBits" column="end_vertex_lo" index="LAGER_DAG_END_VTX_LO"/> </component> </class> </hibernate-mapping>

    Hibernate JIRA | 4 years ago | finion
    java.lang.NullPointerException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.hibernate.dialect.function.CastFunction.render()
    2. Hibernate
      CastFunction.render
      1. org.hibernate.dialect.function.CastFunction.render(CastFunction.java:36)
      1 frame
    3. Hibernate HQL/JP-QL Parser
      SqlGenerator.endFunctionTemplate
      1. org.hibernate.hql.ast.SqlGenerator.endFunctionTemplate(SqlGenerator.java:197)
      1 frame
    4. Hibernate
      BasicExecutor.<init>
      1. org.hibernate.hql.antlr.SqlGeneratorBase.methodCall(SqlGeneratorBase.java:2223)
      2. org.hibernate.hql.antlr.SqlGeneratorBase.selectExpr(SqlGeneratorBase.java:1897)
      3. org.hibernate.hql.antlr.SqlGeneratorBase.selectColumn(SqlGeneratorBase.java:1743)
      4. org.hibernate.hql.antlr.SqlGeneratorBase.selectClause(SqlGeneratorBase.java:527)
      5. org.hibernate.hql.antlr.SqlGeneratorBase.selectStatement(SqlGeneratorBase.java:175)
      6. org.hibernate.hql.antlr.SqlGeneratorBase.insertStatement(SqlGeneratorBase.java:444)
      7. org.hibernate.hql.antlr.SqlGeneratorBase.statement(SqlGeneratorBase.java:137)
      8. org.hibernate.hql.ast.exec.BasicExecutor.<init>(BasicExecutor.java:42)
      8 frames
    5. Hibernate HQL/JP-QL Parser
      QueryTranslatorImpl.compile
      1. org.hibernate.hql.ast.QueryTranslatorImpl.buildAppropriateStatementExecutor(QueryTranslatorImpl.java:535)
      2. org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:178)
      3. org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:113)
      3 frames
    6. Hibernate
      SessionImpl.createQuery
      1. org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
      2. org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
      3. org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
      4. org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
      5. org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
      6. org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1624)
      6 frames
    7. com.gss.lager
      HibernateTest.main
      1. com.gss.lager.HibernateTest.main(HibernateTest.java:42)
      1 frame