Thursday, April 11, 2013

Hibernate NullPointerException on getNamedParameterExpectedType

I received this very cryptic message from a Hibernate query today:
java.lang.NullPointerException at org.hibernate.hql.internal.ast.ParameterTranslationsImpl.getNamedParameterExpectedType(ParameterTranslationsImpl.java:87) at org.hibernate.engine.query.spi.HQLQueryPlan.buildParameterMetadata(HQLQueryPlan.java:319) at org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:124) at org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:80) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168) at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:219) at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:197) ...
A quick google search found this bug which basically says you have too many parenthesis.

So, watch your closing parenthesis because Hibernate doesn't know how to give helpful error messages.

6 comments: