Same query loads from Service but not from screen designer

The query I have used in my service works file but when I use it in Datasource in screen design, it doesn’t work!

Here is my code used in Service

 public List<FactoryProductionStage> getFactoryProductionStageList(Factory factory) {
        List<FactoryProductionStage> list = new ArrayList<>();
        EntityManager em = persistence.getEntityManager();
        String queryString = "select s from mydb$Factory f JOIN f.factoryProductionProcess p JOIN p.factoryProductionStage s \n" +
                "WHERE = ?1 ORDER BY s.ordinalPosition";
        TypedQuery<FactoryProductionStage> query = em.createQuery(queryString, FactoryProductionStage.class);
        query.setParameter(1, factory.getId());
        list = query.getResultList();
        return list;

I am using the same query, same view as attached, it shows error and the application terminates; snapshot attached. What went wrong!!



Please attach the exception stacktrace.