-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Query works on version <= 3.1.1 but not on v. >= 3.1.3
PostPosted: Mon Sep 04, 2006 7:42 am 
Newbie

Joined: Wed Oct 06, 2004 10:34 am
Posts: 16
Location: Teresina - PI - Brasil
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???...

_________________
Regis Pires


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 12, 2007 8:08 pm 
Newbie

Joined: Wed Oct 25, 2006 3:26 pm
Posts: 7
I came across a similar problem when trying to set the LIMIT in a query with a named parameter ie:

select Object(c) from Customer c ORDER BY c.lastName DESC LIMIT :limit

The workaround (not nice - but works !) was to add a WHERE clause:

WHERE ( :limit >=0 OR :limit < 0 )

-Mike


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.