title: antlr.NoViableAltException: unexpected token, WHERE clause, and unexpected token
body: <p>I've already searched other problems related to this but I've just realized that maybe it's in the query of mine perhaps that this problem occurred or in the hibernate </p>
  
  <p>SEE The where clause, it hasn't been called yet its there 
  what could be the problem?</p>
  
  <p>Here is the whole code
          try{
              //one by one check the select field
              String query = "Select emp.employeeID,emp.firstName,emp.middleName,emp.lastName,pos.positionName,dept.deptName,work.workplaceName"
                      +"from Employee emp "
                      + "INNER JOIN Department dept "
                          + "ON emp.departmentID = dept.deptID " 
                      + "INNER JOIN Position pos " 
                          + "ON emp.positionID = pos.positionID "
                      + "INNER JOIN Workplace work " 
                          + "ON emp.workplaceID = work.workplaceID ";</p>
  
  <pre><code>                if(checkAllNotEmpty(data)) {
                      query = query.concat("WHERE ");
  
                      if(data.getEmployeeID() != null &amp;&amp; !data.getEmployeeID().equals("")) {  
                          criteria.add(CRITERIA_EMPLOYEEID2);
                          System.out.println("Employee IDs");
                          input_empID = true;
                      } 
  
                      if(data.getEmployeeName()!= null &amp;&amp; !data.getEmployeeName().equals("")){ 
                          criteria.add(nameCriteriaHelper(data.getEmployeeName()));
                          System.out.println("Employee Name AKOOO");
                          input_empName = true;
                      }
  
                      if(data.getDepartmentID()!=0) {
                          criteria.add(CRITERIA_DEPARTMENT);
                          System.out.println("Dept ID ");
                          selected_dept = true;
                      }
                      if(data.getPositionID()!=0) {
                          criteria.add(CRITERIA_POSITION);
                          System.out.println("POS ID ");
                          selected_pos = true;
                      }
                      if(data.getWorkplaceID()!=0) {
                          criteria.add(CRITERIA_WORKPLACE);
                          selected_work = true;
                      }
  
                      query = query.concat(String.join(" OR ", criteria));
                  }
                  query = query.concat(" ORDER BY emp.joinDate DESC");
                  System.out.println("QUERY: " + query);
                  Query q = session.createQuery(query);
                  if(input_empID) {
                      q.setParameter("id", "%" + data.getEmployeeID() + "%");
                  }
                  if(input_empName) {
                      if(searchbyOne)
                          q.setParameter("inputName", "%" + data.getEmployeeName() + "%");
                      if(searchbyFandL)
                          q.setParameter("firstLastName", "%" +firstLastName+ "%");
                      if(searchbyCompName)
                          q.setParameter("completeName", "%" +completeName+ "%");
                  }
  
                  if(selected_dept) {
                      q.setParameter("deptID", data.getDepartmentID());
                  }
                  if(selected_pos) {
                      q.setParameter("posID", data.getPositionID());
                  }
                  if(selected_work) {
                      q.setParameter("workID", data.getWorkplaceID());
                  }
                  employees = (List&lt;Object&gt;) q.list();
      }catch(Exception e){
          e.printStackTrace();
      }finally{
          session.close();
      }
  
      return employees;
  }
  </code></pre>
  
  <p>So Help T.T</p>