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

NullPointerException in QueryImpl#extractParameterInfo

Description

A NullPointerException may be thrown from QueryImpl#extractParameterInfo:

1 2 3 4 5 6 7 8 9 10 11 java.lang.NullPointerException at org.hibernate.ejb.QueryImpl.extractParameterInfo(QueryImpl.java:114) at org.hibernate.ejb.QueryImpl.<init>(QueryImpl.java:97) at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:467) at org.hibernate.ejb.criteria.CriteriaQueryCompiler.compile(CriteriaQueryCompiler.java:221) at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:587) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:241)

This appears to be a regression introduced in Hibernate 4.2.3 related to HHH-8283.

This seems to occur when the right-hand operand contains an expression; e.g:

1 select ... where name=lower(?)

In the BinaryLogicOperatorNode#initialize method, the expected type of the node is never set and therefore remains null throughout. As a result, the new logic introduced in the QueryImpl#extractParameterInfo by which obtains the corresponding class of the param's expected type now fails with an NPE.

Environment

None

Status

Assignee

Brett Meyer

Reporter

ShelleyB

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

4.2.3

Priority

Major