title: JPQL createQuery is incompatible with query return type Collection
body: <p>I want to get my profile in class Tournee (profil_tournee) list based on my tours ("tournee"). However, I have an exception. Can anyone help me?</p>
  
  <blockquote>
    <p>Exception in thread "AWT-EventQueue-0"
    java.lang.IllegalArgumentException: Type specified for TypedQuery
    [fr.galettedebroons.domain.Profil] is incompatible with query return
    type [interface java.util.Collection]</p>
  </blockquote>
  
  <p>Request: </p>
  
  <pre class="lang-java prettyprint-override"><code> List&lt;List&lt;Profil&gt;&gt; listProfil = Arrays.asList(manager_.createQuery("select t.profil_tournee "
              + "FROM Tournee t WHERE t.nom LIKE :tournee", Profil.class)
              .setParameter("tournee", tournee)
              .getResultList());
  </code></pre>
  
  <p>Model : </p>
  
  <pre class="lang-java prettyprint-override"><code>@Entity
  public class Tournee {
      private int id;
      private String nom;
      private boolean lundi = false;
      private boolean mardi = false;
      private boolean mercredi = false;
      private boolean jeudi = false;
      private boolean vendredi = false;
      private boolean samedi = false;
      private boolean dimanche = false;
      private List&lt;Profil&gt; profil_tournee;
  
      public Tournee(){}
  
      public Tournee(String nom, boolean lundi, boolean mardi, boolean mercredi, boolean jeudi,
              boolean vendredi, boolean samedi, boolean dimanche, List&lt;Profil&gt; profil_tournee) {
          this.nom = nom;
          this.lundi = lundi;
          this.mardi = mardi;
          this.mercredi = mercredi;
          this.jeudi = jeudi;
          this.vendredi = vendredi;
          this.samedi = samedi;
          this.dimanche = dimanche;
          this.profil_tournee = profil_tournee;
      }
  
      public Tournee(String nom, boolean lundi, boolean mardi, boolean mercredi, boolean jeudi,
              boolean vendredi, boolean samedi, boolean dimanche) {
          this.nom = nom;
          this.lundi = lundi;
          this.mardi = mardi;
          this.mercredi = mercredi;
          this.jeudi = jeudi;
          this.vendredi = vendredi;
          this.samedi = samedi;
          this.dimanche = dimanche;
      }
  
      @Id @GeneratedValue(strategy = GenerationType.AUTO)
      public int getId() {
          return id;
      }
  
      public void setId(int id_tournee) {
          this.id = id_tournee;
      }
  
      public String getNom() {
          return nom;
      }
  
      public void setNom(String nom) {
          this.nom = nom;
      }
  
      public boolean isLundi() {
          return lundi;
      }
  
      public void setLundi(boolean lundi) {
          this.lundi = lundi;
      }
  
      public boolean isMardi() {
          return mardi;
      }
  
      public void setMardi(boolean mardi) {
          this.mardi = mardi;
      }
  
      public boolean isMercredi() {
          return mercredi;
      }
  
      public void setMercredi(boolean mercredi) {
          this.mercredi = mercredi;
      }
  
      public boolean isJeudi() {
          return jeudi;
      }
  
      public void setJeudi(boolean jeudi) {
          this.jeudi = jeudi;
      }
  
      public boolean isVendredi() {
          return vendredi;
      }
  
      public void setVendredi(boolean vendredi) {
          this.vendredi = vendredi;
      }
  
      public boolean isSamedi() {
          return samedi;
      }
  
      public void setSamedi(boolean samedi) {
          this.samedi = samedi;
      }
  
      public boolean isDimanche() {
          return dimanche;
      }
  
      public void setDimanche(boolean dimanche) {
          this.dimanche = dimanche;
      }
  
      @OneToMany(mappedBy="profil_tournee", cascade=CascadeType.PERSIST)
      public List&lt;Profil&gt; getProfil_tournee() {
          return profil_tournee;
      }
  
      public void setProfil_tournee(List&lt;Profil&gt; profil_tournee) {
          this.profil_tournee = profil_tournee;
      }
  }
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>@Entity
  public class Profil {
      private String code_client;
      private Client client_profil;
      private Gamme gamme_profil;
      private List&lt;Livraison&gt; livraison_profil;
      private Boolean actif;
      private Tournee profil_tournee;
      private List&lt;MargeLivraison&gt; marge_profil;
      private List&lt;Prevision&gt; prevision_profil;
  
      public Profil(){}
  
      public Profil(Gamme code_gamme, List&lt;Livraison&gt; livraison, Boolean actif) {
          this.gamme_profil = code_gamme;
          this.livraison_profil = livraison;
          this.actif = actif;
      }
  
      @Id
      public String getCode_client() {
          return code_client;
      }
  
      public void setCode_client(String code_client) {
          this.code_client = code_client;
      }
  
      public Boolean getActif() {
          return actif;
      }
  
      public void setActif(Boolean actif) {
          this.actif = actif;
      }
  
      @ManyToOne
      public Gamme getGamme_profil() {
          return gamme_profil;
      }
  
      public void setGamme_profil(Gamme gamme_profil) {
          this.gamme_profil = gamme_profil;
      }
  
      @OneToMany(mappedBy="livraison_profil", cascade=CascadeType.PERSIST)
      public List&lt;Livraison&gt; getLivraison_profil() {
          return livraison_profil;
      }
  
      public void setLivraison_profil(List&lt;Livraison&gt; livraison_profil) {
          this.livraison_profil = livraison_profil;
      }
  
      @ManyToOne
      public Client getClient_profil() {
          return client_profil;
      }
  
      public void setClient_profil(Client client) {
          this.client_profil = client;
      }
  
      @ManyToOne
      public Tournee getProfil_tournee() {
          return profil_tournee;
      }
  
      public void setProfil_tournee(Tournee profil_tournee) {
          this.profil_tournee = profil_tournee;
      }
  
      @OneToMany(mappedBy="marge_profil", cascade=CascadeType.PERSIST)
      public List&lt;MargeLivraison&gt; getMarge_profil() {
          return marge_profil;
      }
  
      public void setMarge_profil(List&lt;MargeLivraison&gt; marge_profil) {
          this.marge_profil = marge_profil;
      }
  
      @OneToMany(mappedBy="prevision_profil", cascade=CascadeType.PERSIST)
      public List&lt;Prevision&gt; getPrevision_profil() {
          return prevision_profil;
      }
  
      public void setPrevision_profil(List&lt;Prevision&gt; prevision_profil) {
          this.prevision_profil = prevision_profil;
      }
  </code></pre>