We have a query that works perfectly in Hibernate version 3.1.1 but it does not work with Hibernate version >= 3.1.3 (even latest 3.2.0 release - cr4). We use PostgreSQL version 8.1.4.
Our query:
Code:
select credit from Credit credit
where NAME_INDEX(credit.favorecido.name) like NAME_INDEX(:name) || '%')
and credit.date between :startDate and :endDate
We get the following exception when we use Hibernate version 3.1.3 and above:
Code:
java.lang.NullPointerException
at org.hibernate.hql.ast.ParameterTranslationsImpl.getNamedParameterExpectedType(ParameterTranslationsImpl.java:63)
at org.hibernate.engine.query.HQLQueryPlan.buildParameterMetadata(HQLQueryPlan.java:300)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:97)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:401)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:351)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
The problem occurs in all queries that use parameters in 'NAME_INDEX' function.
So we are still using Hibernate version 3.1.1.
Can someone help us???...