title: Native Query is not working in JPA: why?
body: <p>I want to make a query that returns a list of objects from a database. There seem to be something wrong with the query because of the error : Encountered 'by' at line x column xx. I don't know what is wrong about the query. Can someone pls help.</p>
  
  <pre><code>public List&lt;Film&gt; getFilmsVanRegisseur(String voornaam, String achternaam){
  
          List&lt;Film&gt; l;
          //de fout zit in de query
          Query q = em.createNativeQuery(""
                  + "select films.filmnaam,films.uitgavejaar "
                  + "from films "
                  + "inner join regisseurs on films.regisseur = regisseurs.id "
                  + "inner join filmmedewerkers on filmmedewerkers.id = regisseurs.id "
                  + "where filmmedewerkers.voornaam = ? and filmmedewerkers.achternaam = ?"
                  + "group by films.filmnaam, films.uitgavejaar", Film.class);
          q.setParameter(1, voornaam);
          q.setParameter(2, achternaam);
  
          l = q.getResultList();
  
          return l;
  
      }
  </code></pre>
  
  <p>The tables in the database are Films, Filmmedewerkers and Regisseur which is a specific type of Filmmedewerkers. I want to make a query that returns a list of Films from a Regisseur with a voornaam and achternaam (as you can see in the parameters) the tables are correctly connected.</p>