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.

  • We upgraded from 5.1 to 5.2 and started getting exceptions in some of our HQL queries. We currently use the SessionManager managed through Spring (as opposed to the EntityManager). h5. HQL Query: {code} String QUERY_HQL_MANY_TO_ONE_REFERENCES = "from InformationResource r1 where r1.publisher.id in (:idlist)"; {code} h5. NamedParameterSpecification.java with comments: {code} // name is "idlist" TypedValue typedValue = qp.getNamedParameters().get( name ); // typedValue is NULL typedValue.getType().nullSafeSet( statement, typedValue.getValue(), position, session ); {code} h5. Exception: {code} java.lang.NullPointerException at org.hibernate.param.NamedParameterSpecification.bind(NamedParameterSpecification.java:53) at org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:628) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1949) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1902) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1880) at org.hibernate.loader.Loader.scroll(Loader.java:2684) at org.hibernate.loader.hql.QueryLoader.scroll(QueryLoader.java:571) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.scroll(QueryTranslatorImpl.java:423) at org.hibernate.engine.query.spi.HQLQueryPlan.performScroll(HQLQueryPlan.java:350) at org.hibernate.internal.SessionImpl.scroll(SessionImpl.java:1543) at org.hibernate.query.internal.AbstractProducedQuery.doScroll(AbstractProducedQuery.java:1310) at org.hibernate.query.internal.AbstractProducedQuery.scroll(AbstractProducedQuery.java:1300) at org.hibernate.query.internal.AbstractProducedQuery.scroll(AbstractProducedQuery.java:99) at org.tdar.core.dao.ReflectionDao.findReferrers(ReflectionDao.java:60) {code} h5. Base Classes {code} @Entity @Table(name = "resource") @Inheritance(strategy = InheritanceType.JOINED) public class Resource { @Id private Long id = -1L; public Long getId() { return id; } public void setId(Long id) { this.id = id; } } ------ public abstract class InformationResource extends Resource { @ManyToOne(optional = true, cascade = { CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE, CascadeType.DETACH }) private Institution publisher; public Institution getPublisher() { return publisher; } public void setPublisher(Institution publisher) { this.publisher = publisher; } } public class Institution { @Id private Long id = -1L; public Long getId() { return id; } public void setId(Long id) { this.id = id; } } public class Document extends InformationResource { ... } {code}
    via by adam,
  • We upgraded from 5.1 to 5.2 and started getting exceptions in some of our HQL queries. We currently use the SessionManager managed through Spring (as opposed to the EntityManager). h5. HQL Query: {code} String QUERY_HQL_MANY_TO_ONE_REFERENCES = "from InformationResource r1 where r1.publisher.id in (:idlist)"; {code} h5. NamedParameterSpecification.java with comments: {code} // name is "idlist" TypedValue typedValue = qp.getNamedParameters().get( name ); // typedValue is NULL typedValue.getType().nullSafeSet( statement, typedValue.getValue(), position, session ); {code} h5. Exception: {code} java.lang.NullPointerException at org.hibernate.param.NamedParameterSpecification.bind(NamedParameterSpecification.java:53) at org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:628) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1949) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1902) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1880) at org.hibernate.loader.Loader.scroll(Loader.java:2684) at org.hibernate.loader.hql.QueryLoader.scroll(QueryLoader.java:571) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.scroll(QueryTranslatorImpl.java:423) at org.hibernate.engine.query.spi.HQLQueryPlan.performScroll(HQLQueryPlan.java:350) at org.hibernate.internal.SessionImpl.scroll(SessionImpl.java:1543) at org.hibernate.query.internal.AbstractProducedQuery.doScroll(AbstractProducedQuery.java:1310) at org.hibernate.query.internal.AbstractProducedQuery.scroll(AbstractProducedQuery.java:1300) at org.hibernate.query.internal.AbstractProducedQuery.scroll(AbstractProducedQuery.java:99) at org.tdar.core.dao.ReflectionDao.findReferrers(ReflectionDao.java:60) {code} h5. Base Classes {code} @Entity @Table(name = "resource") @Inheritance(strategy = InheritanceType.JOINED) public class Resource { @Id private Long id = -1L; public Long getId() { return id; } public void setId(Long id) { this.id = id; } } ------ public abstract class InformationResource extends Resource { @ManyToOne(optional = true, cascade = { CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE, CascadeType.DETACH }) private Institution publisher; public Institution getPublisher() { return publisher; } public void setPublisher(Institution publisher) { this.publisher = publisher; } } public class Institution { @Id private Long id = -1L; public Long getId() { return id; } public void setId(Long id) { this.id = id; } } public class Document extends InformationResource { ... } {code}
    via by adam,
  • Error when saving product
    via GitHub by sumitverma
    ,
    • java.lang.NullPointerException at org.hibernate.param.NamedParameterSpecification.bind(NamedParameterSpecification.java:53) at org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:628) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1949) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1902) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1880) at org.hibernate.loader.Loader.scroll(Loader.java:2684) at org.hibernate.loader.hql.QueryLoader.scroll(QueryLoader.java:571) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.scroll(QueryTranslatorImpl.java:423) at org.hibernate.engine.query.spi.HQLQueryPlan.performScroll(HQLQueryPlan.java:350) at org.hibernate.internal.SessionImpl.scroll(SessionImpl.java:1543) at org.hibernate.query.internal.AbstractProducedQuery.doScroll(AbstractProducedQuery.java:1310) at org.hibernate.query.internal.AbstractProducedQuery.scroll(AbstractProducedQuery.java:1300) at org.hibernate.query.internal.AbstractProducedQuery.scroll(AbstractProducedQuery.java:99) at org.tdar.core.dao.ReflectionDao.findReferrers(ReflectionDao.java:60)
    No Bugmate found.