title: Type specified for TypedQuery is incompatible with query return type [class java.lang.Double]
body: <p>I'am trying to make a join between two entities using j2ee and hibernate.
  But I get the following error:</p>
  
  <p><code>java.lang.IllegalArgumentException: Type specified for TypedQuery  is incompatible with query return type [class java.lang.Double]</code></p>
  
  <p>This is the query that I'm trying to get work</p>
  
  <pre><code>Query query = entityManager
                  .createQuery("SELECT avg(responseEnd - responseStart)  FROM QualiteDeService q  join q.test",QualiteDeService.class );
  </code></pre>
  
  <p>And these are the entities:</p>
  
  <pre><code>    @Entity
      public class QualiteDeService {
  
          private int id_qualite_service;
              private Test test;
  
          @Id    
          @GeneratedValue(strategy=GenerationType.IDENTITY)
          public int getId_qualite_service() {
              return id_qualite_service;
          }
          @ManyToOne
          @JoinColumn(name = "id_test", referencedColumnName = "id_test", insertable = false, updatable = false)
          public Test getTest() {
              return test;
          }
          public void setTest(Test test) {
              this.test = test;
          }
      }
  
  
      @Entity
      public class Test implements Serializable{
      private int id_test;
  private int note;
  
      @Id    
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      public int getId_test() {
          return id_test;
      }
      public void setId_test(int id_test) {
          this.id_test = id_test;
      }
      }
  </code></pre>