java.lang.NullPointerException

Hibernate JIRA | Santhakumar | 1 year ago
  1. 0

    While listing some data from DB where we are getting below error. When i debug LoadQueryInfluencer parameter which i have created the object from the session.getLoadQueryInfluencer(). where from application log i can able to see the object is loaded where as in hibernate stacktrace in hibernate its giving null. Below is the logs and snippet of the issue. Please help me out. ~String[] implementors = factory.getImplementors(criteriaImplValue.getEntityOrClassName()); LOG.info(":::::Entity Names 'Implementors' array string length:::::"+implementors.length); if(getLoadQueryInflncr() ==null){ setLoadQueryInflncr(((SessionImpl)factory.getCurrentSession()).getLoadQueryInfluencers()); LOG.info(":::::LoadQueryInfluencer object created using factory.getLoadQueryInfluencers() method:::::"); }else{ setLoadQueryInflncr(new LoadQueryInfluencers(factory)); LOG.info(":::::LoadQueryInfluencer object created using constructor:::::"); } LOG.info("Entity Name"+ factory .getEntityPersister(implementors[0]) +"SessionImplementorFactory"+factory+"Criteria Impl Value"+criteriaImplValue+ "Entity Root Name"+implementors[0]+"Load Query influencer"+loadQueryInflncr.toString()); for(int i=0; i< implementors.length; i++){ loader[i] = new CriteriaLoader((OuterJoinLoadable) factory .getEntityPersister(implementors[i]), factory, criteriaImplValue, implementors[i], getLoadQueryInflncr()/*new LoadQueryInfluencers() no filters */); }~ java.lang.NullPointerException at org.hibernate.criterion.SubqueryExpression.toSqlString(SubqueryExpression.java:83) at org.hibernate.criterion.LogicalExpression.toSqlString(LogicalExpression.java:62) at org.hibernate.criterion.Junction.toSqlString(Junction.java:82) at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:380) at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:102) at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:82) at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:92) +_+org.hibernate.criterion.SubqueryExpression+_+ System.out.println(":::::Entering hibernate Sub Query Expression :::::::: "); System.out.println(":::::Criteria :::::::: " + criteria + ":::::Crtier Query :::::::" + criteriaQuery); SessionFactoryImplementor factory = criteriaQuery.getFactory(); System.out.println(":::::SessionImplelmentor Factory :::::::: " + factory); OuterJoinLoadable persister = (OuterJoinLoadable)factory.getEntityPersister(this.criteriaImpl.getEntityOrClassName()); System.out.println(":::::Session from CriteriaImpl :::::::: " + persister.getEntityName()); createAndSetInnerQuery(criteriaQuery, factory); this.criteriaImpl.setSession(deriveRootSession(criteria)); System.out.println(":::::Innerquery :::::::: " + this.innerQuery.getRootCriteria().getEntityOrClassName()); System.out.println(":::::criteriaImpl getEntityOrClassName :::::::: " + this.criteriaImpl.getEntityOrClassName()); System.out.println(":::::criteriaImpl getSession().getLoadQueryInfluencers() :::::::: " + this.criteriaImpl.getSession().getLoadQueryInfluencers().getClass().getName()); System.out.println(":::::innerQuery.getRootSQLALias() :::::::: " + this.innerQuery.getRootSQLALias());

    Hibernate JIRA | 1 year ago | Santhakumar
    java.lang.NullPointerException
  2. 0

    While listing some data from DB where we are getting below error. When i debug LoadQueryInfluencer parameter which i have created the object from the session.getLoadQueryInfluencer(). where from application log i can able to see the object is loaded where as in hibernate stacktrace in hibernate its giving null. Below is the logs and snippet of the issue. Please help me out. ~String[] implementors = factory.getImplementors(criteriaImplValue.getEntityOrClassName()); LOG.info(":::::Entity Names 'Implementors' array string length:::::"+implementors.length); if(getLoadQueryInflncr() ==null){ setLoadQueryInflncr(((SessionImpl)factory.getCurrentSession()).getLoadQueryInfluencers()); LOG.info(":::::LoadQueryInfluencer object created using factory.getLoadQueryInfluencers() method:::::"); }else{ setLoadQueryInflncr(new LoadQueryInfluencers(factory)); LOG.info(":::::LoadQueryInfluencer object created using constructor:::::"); } LOG.info("Entity Name"+ factory .getEntityPersister(implementors[0]) +"SessionImplementorFactory"+factory+"Criteria Impl Value"+criteriaImplValue+ "Entity Root Name"+implementors[0]+"Load Query influencer"+loadQueryInflncr.toString()); for(int i=0; i< implementors.length; i++){ loader[i] = new CriteriaLoader((OuterJoinLoadable) factory .getEntityPersister(implementors[i]), factory, criteriaImplValue, implementors[i], getLoadQueryInflncr()/*new LoadQueryInfluencers() no filters */); }~ java.lang.NullPointerException at org.hibernate.criterion.SubqueryExpression.toSqlString(SubqueryExpression.java:83) at org.hibernate.criterion.LogicalExpression.toSqlString(LogicalExpression.java:62) at org.hibernate.criterion.Junction.toSqlString(Junction.java:82) at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:380) at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:102) at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:82) at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:92) +_+org.hibernate.criterion.SubqueryExpression+_+ System.out.println(":::::Entering hibernate Sub Query Expression :::::::: "); System.out.println(":::::Criteria :::::::: " + criteria + ":::::Crtier Query :::::::" + criteriaQuery); SessionFactoryImplementor factory = criteriaQuery.getFactory(); System.out.println(":::::SessionImplelmentor Factory :::::::: " + factory); OuterJoinLoadable persister = (OuterJoinLoadable)factory.getEntityPersister(this.criteriaImpl.getEntityOrClassName()); System.out.println(":::::Session from CriteriaImpl :::::::: " + persister.getEntityName()); createAndSetInnerQuery(criteriaQuery, factory); this.criteriaImpl.setSession(deriveRootSession(criteria)); System.out.println(":::::Innerquery :::::::: " + this.innerQuery.getRootCriteria().getEntityOrClassName()); System.out.println(":::::criteriaImpl getEntityOrClassName :::::::: " + this.criteriaImpl.getEntityOrClassName()); System.out.println(":::::criteriaImpl getSession().getLoadQueryInfluencers() :::::::: " + this.criteriaImpl.getSession().getLoadQueryInfluencers().getClass().getName()); System.out.println(":::::innerQuery.getRootSQLALias() :::::::: " + this.innerQuery.getRootSQLALias());

    Hibernate JIRA | 1 year ago | Santhakumar
    java.lang.NullPointerException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.hibernate.criterion.SubqueryExpression.toSqlString()
    2. Hibernate
      CriteriaLoader.<init>
      1. org.hibernate.criterion.SubqueryExpression.toSqlString(SubqueryExpression.java:83)
      2. org.hibernate.criterion.LogicalExpression.toSqlString(LogicalExpression.java:62)
      3. org.hibernate.criterion.Junction.toSqlString(Junction.java:82)
      4. org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:380)
      5. org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:102)
      6. org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:82)
      7. org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:92)
      7 frames