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 : QueryParameterException could not locate named parameter

 
Jehan Jaleel
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a native SQL query which I want to execute through Hibernate...



The above code is leading to below exception....



createdBy is a column in the Run table and in the Run JPA entity, so I really do not know why it is not identifying it as a parameter.

Thanks in advance for any help.
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at the Hibernate docs, you can have either positional or named parameters when using native queries.

Positional

Named

Looking at your code, you will need something like this:
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!