Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate QueryException: Not all named parameters have been set:

 
Janusz Nowak
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,


When my query is executed i receive stack
Caused by: org.hibernate.QueryException: Not all named parameters have been set: [param0] [select count(generatedAlias0.id)
from Position as generatedAlias0 where generatedAlias0.rank=:param0]


And my executed method




queryCountLarge() returns

QueryBuilder.createCountLarge(em, myClass);


And finally Query Builder


it might be problem with this where clauses aQuery.whereEquals

So it is whereEquals implementation



I don't see any problem, but maybe its kind of optymalization problem?
 
Roel De Nijs
Sheriff
Posts: 10763
148
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Janusz Nowak,

First of all, a warm welcome to CodeRanch!

Janusz Nowak wrote:I don't see any problem, but maybe its kind of optymalization problem?

I think the error message you get, is very clear: in your query you seem to have a named parameter and when you execute your query, you need to provide a value for every named parameter in your query. And it seems that's not the case when you execute the query and therefore you'll get this runtime exception when executing the query.

Hope it helps!
Kind regards,
Roel
 
Tim Holloway
Bartender
Posts: 18469
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Creating a QueryBuilder isn't enough. You need to use it to create an actual Query. You'd then use a setParameter method against the Query to set param0 value before invoking the query to get the desired values.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!