-->
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.  [ 3 posts ] 
Author Message
 Post subject: Not all named parameters have been set:[:int]
PostPosted: Fri Oct 14, 2011 5:52 pm 
Newbie

Joined: Fri Oct 14, 2011 5:41 pm
Posts: 2
hi,

I am getting hibernate exception as
org.hibernate.QueryException: Not all named parameters have been set: [:int]

My code
String queryString ="SELECT history.serial Serial,history.timestamp,avg(regexp_replace(history.num_value,'[^0-9]','','g')::int * 10) NumValue,history.timestamp + interval '7 days' endtime "+
" FROM product_1 history"+
" WHERE history.serialnum = :serialnum"+
" AND history.index1 = :index1"+
" AND history.index2 = :index2"+
" AND history.checknum = :checkNum"+
" AND history.timestamp between :date1 and :date2 group by SerialNumber, timestamp, endtime order by timestamp asc";

SQLQuery query = sessionFactory.getCurrentSession().createSQLQuery(queryString);
query.addScalar("Serial");
query.addScalar("timestamp");
query.addScalar("NumValue");
query.setParameter("serialnum", serial);
query.setParameter("index1", index1);
query.setParameter("index2", index2);
query.setParameter("history.checknum ", keyNumMap.get("history.checknum "));
query.setParameter("date1", beginDate);
query.setParameter("date2", endDate);

Can anybody please tell me where am i goign wrong.
This works if i dont use avg function. I have num_value as character varying datatype in mapping file
thanks in advance


Top
 Profile  
 
 Post subject: Re: Not all named parameters have been set:[:int]
PostPosted: Fri Oct 14, 2011 7:09 pm 
Newbie

Joined: Fri Oct 14, 2011 5:41 pm
Posts: 2
Please let me know if regex_replace is supported by hibernate
I am using postgre DB


Thanks


Top
 Profile  
 
 Post subject: Re: Not all named parameters have been set:[:int]
PostPosted: Tue Oct 25, 2011 10:08 am 
Newbie

Joined: Tue Oct 25, 2011 9:58 am
Posts: 1
Looks like you have not set checknum instead you have set
history.checknum that too with space

query.setParameter("history.checknum ", keyNumMap.get("history.checknum "));


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.