2 Replies Latest reply on Oct 4, 2010 10:20 AM by Leo van den berg

    How to Pass symbolic character in query created by entity manager

    sadique arslan Newbie
      i have a query created in entity manager. when i try to execute this query using hibernet . it throws a genuine error message that i am using a special character @ in this query . But i don't know how can i pass a symbolic character in hibernet query.
      My query is

      private boolean isUniqueEmail(String emailadd)
          {
              String myquery = "select u from AuthenticationInformation u where u.email=" + emailadd;
              Query q = entityManager.createQuery(myquery);
             // q.setParameter(":email", emailadd);
              List res = q.getResultList();
              if (res.size()>0)
              {
                  return false;
              }
              else
              {
                  return true;
              }
          }

      value passing as argument to this method is abc@gmail.com

      ERROR : message is

      Caused by org.hibernate.QueryException with message: "unexpected char: '@' [select u from entity.timi.dot.ca.gov.AuthenticationInformation u where u.email=Sadique4t.ktr@gmail.com]

      Please help me regarding this issue.

      Plz help me regarding i