title: Exception Description: Syntax error parsing
body: <p>I'm beginner Java programmer</p>
  
  <p>I want to run a query with JPQL, but I give an error message</p>
  
  <p>error message</p>
  
  <pre><code>Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.JPQLException
  Exception Description: Syntax error parsing [select u from user u where u.email = :pr1 and u.password = : pr2]. 
  [27, 64] The expression is not a valid conditional expression.
      at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildException(HermesParser.java:155)
      at org.eclipse.persistence.internal.jpa.jpql.HermesParser.validate(HermesParser.java:334)
      at org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:278)
      at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildQuery(HermesParser.java:163)
      at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:142)
      at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:116)
      at org.eclipse.persistence.internal.jpa.EJBQueryImpl.&lt;init&gt;(EJBQueryImpl.java:102)
      at org.eclipse.persistence.internal.jpa.EJBQueryImpl.&lt;init&gt;(EJBQueryImpl.java:86)
      at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1583)
      ... 85 more
  </code></pre>
  
  <p>query</p>
  
  <pre><code>@EJB
      private UserFacade usersfacede;
      private String redirect;
  
      public void dologin(){
  
          String query1 ="select u from user u where u.email = :pr1 and u.password = : pr2";
          List&lt;User&gt; loginuser = usersfacede.araStr(query1, email.trim(), password.trim(), "", "", "");
  
          if(loginuser.size()&gt;0){
              Util.setSessionAttribute("name", loginuser.get(0).getName());
              redirect="index.xhtml?faces-redirect=true";
          }else{
              redirect="";
              FacesContext context = FacesContext.getCurrentInstance();
              context.addMessage(null, new FacesMessage("error",  "") );
          }
      }
  </code></pre>
  
  <p>make UserFacede extends AbstractFacade </p>
  
  <p>arastr function in AbstractFacade.java</p>
  
  <pre><code> /*
   * To change this license header, choose License Headers in Project Properties.
   * To change this template file, choose Tools | Templates
   * and open the template in the editor.
   */
  
  package com.entity;
  
  import java.util.List;
  import javax.persistence.EntityManager;
  import javax.persistence.Query;
  
  /**
   *
   * @author seref
   */
  public abstract class AbstractFacade&lt;T&gt; {
      private Class&lt;T&gt; entityClass;
  
      public AbstractFacade(Class&lt;T&gt; entityClass) {
          this.entityClass = entityClass;
      }
  
      public List&lt;T&gt; araStr(String sorgu, String pr1, String pr2, String pr3, String pr4, String pr5) {
          Query query = getEntityManager().createQuery(sorgu);
          if (pr1 != null &amp; !"".equals(pr1)) {
              query.setParameter("pr1", pr1);
          }
          if (pr2 != null &amp; !"".equals(pr2)) {
              query.setParameter("pr2", pr2);
          }
          if (pr3 != null &amp; !"".equals(pr3)) {
              query.setParameter("pr3", pr3);
          }
          if (pr4 != null &amp; !"".equals(pr4)) {
              query.setParameter("pr4", pr4);
          }
          if (pr5 != null &amp; !"".equals(pr5)) {
              query.setParameter("pr5", pr5);
          }
          System.out.print(query.toString());
  
          List&lt;T&gt; list = query.getResultList();
  
          return (List&lt;T&gt;) list;
      }
  
  
      protected abstract EntityManager getEntityManager();
  
      public void create(T entity) {
          getEntityManager().persist(entity);
      }
  
      public void edit(T entity) {
          getEntityManager().merge(entity);
      }
  
      public void remove(T entity) {
          getEntityManager().remove(getEntityManager().merge(entity));
      }
  
      public T find(Object id) {
          return getEntityManager().find(entityClass, id);
      }
  
      public List&lt;T&gt; findAll() {
          javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();
          cq.select(cq.from(entityClass));
          return getEntityManager().createQuery(cq).getResultList();
      }
  
      public List&lt;T&gt; findRange(int[] range) {
          javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();
          cq.select(cq.from(entityClass));
          javax.persistence.Query q = getEntityManager().createQuery(cq);
          q.setMaxResults(range[1] - range[0] + 1);
          q.setFirstResult(range[0]);
          return q.getResultList();
      }
  
      public int count() {
          javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();
          javax.persistence.criteria.Root&lt;T&gt; rt = cq.from(entityClass);
          cq.select(getEntityManager().getCriteriaBuilder().count(rt));
          javax.persistence.Query q = getEntityManager().createQuery(cq);
          return ((Long) q.getSingleResult()).intValue();
      }
  
  }
  </code></pre>
  
  <p>Does someone know where is error?</p>