java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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());
    via by Santhakumar ,
  • 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());
    via by Santhakumar ,
  • HOW to use HAVING COUNT(*) with hibernate
    via Stack Overflow by Nicolas400
    ,
  • Hibernate Criteria Api Subqueries
    via Stack Overflow by BuffaloBuffalo
    ,
    • 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)
    No Bugmate found.