We're updating the issue view to help you get more done. 

Query#scroll() throws NPE

Description

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).

HQL Query:
1 String QUERY_HQL_MANY_TO_ONE_REFERENCES = "from InformationResource r1 where r1.publisher.id in (:idlist)";
NamedParameterSpecification.java with comments:
1 2 3 4 // name is "idlist" TypedValue typedValue = qp.getNamedParameters().get( name ); // typedValue is NULL typedValue.getType().nullSafeSet( statement, typedValue.getValue(), position, session );
Exception:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 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)
Base Classes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 @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 { ... }

Environment

None

Status

Assignee

Andrea Boriero

Reporter

adamb

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.0

Priority

Major