This content has been marked as final.
Show 2 replies
-
1. Re: How to Pass symbolic character in query created by entity manager
cash1981 Oct 4, 2010 9:39 AM (in response to sadiquekatihar)Can you also show how you send this in your form/view?
My guess is that you are either sending as request parameter or get method as parameter in method.
This is not the preferred way of doing it. -
2. Re: How to Pass symbolic character in query created by entity manager
lvdberg Oct 4, 2010 10:20 AM (in response to sadiquekatihar)Hi,
You're using String concatenation to create the query string. It can work, but it is realy eror-prone such as in your case. You're missing the single quotes around the email address that's the reason that it doesn't work.
Try the following:
String myquery = "select u from AuthenticationInformation u where u.email=' " + emailadd + " ' ";
The best way to prevent these kind of error is to use parameters in you query as you already tried. Something like:
String myquery = "select u from AuthenticationInformation u where u.email = :email"; q.setParameter("email", emailadd);
The name of the parameter is WITHOUT the
:
.Leo