Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

What is wrong with this EJB QL query?

843830May 28 2006 — edited May 28 2006
I am getting this exception:

Caused by: java.lang.IllegalArgumentException: NamedQuery of name: Client.findByCUserName = :sessionName not found.
at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getDatabaseQuery(EJBQueryImpl.java:379)

Here is the query:
public Client getUserName(String UserName) {

//Client entity = null;
Client clientsession =
(Client) em.createNamedQuery("Client.findByCUserName = :sessionName")
.setParameter("sessionName",UserName).getSingleResult();

return clientsession;

}

And the relevant part of the Entity bean

@NamedQuery(name = "Client.findByCUserName", query = "SELECT c FROM Client c WHERE c.cUserName = :cUserName")

Thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 25 2006
Added on May 28 2006
2 comments
89 views