File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes JPQL - org.hibernate.QueryParameter Exception: could not locate named parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JPQL - org.hibernate.QueryParameter Exception: could not locate named parameter" Watch "JPQL - org.hibernate.QueryParameter Exception: could not locate named parameter" New topic
Author

JPQL - org.hibernate.QueryParameter Exception: could not locate named parameter

Johannes Koch
Greenhorn

Joined: Dec 25, 2005
Posts: 11
I am trying to execute two JPQL queries in an EJB3 application deployed on a JBoss 4.2.2.GA. The code looks as follows:

While the first query works fine, the second one results in the following error:

Even more strange: When I try to switch to a numbered parameter, like this

the error message stays the same and still complains about a named parameter:

This is also not affected by whether I pass the parameter value as int (2), String ("2") or Integer (new Integer(2)).
The only difference I can notice between the two queries is that in the second one I'm using a fully qualified name for the persisted Entity because the class is defined in a different package. Maybe Hibernate gets confused by that?

Can anybody give me a hint? I'm totally out of ideas.
[ June 03, 2008: Message edited by: Johannes Koch ]
Johannes Koch
Greenhorn

Joined: Dec 25, 2005
Posts: 11
Found the answer here:
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4155809#4155809
Thanks for reading.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPQL - org.hibernate.QueryParameter Exception: could not locate named parameter
 
Similar Threads
Named queries and EJBQL
JPQL - Query Parameter
JPA native Query - Select... where... IN, How to set list of values to setParameter()?
JPA trying to pass list to IN part of query
JPA Query using " where in" and setParameter