title: JPA multiple select query
body: <p>I have a query like this, how can I get my entity type from the list? It is returning like object,but when I cast to my Entity it does not cast.</p>
  
  <p>my tables: <code>B(id_A, id_C)    , A(id_A,name,location)   C (id_C,......)</code></p>
  
  <pre><code>        String queryCompany = "select s.name,s.location from B b," +
                  " A s where b.bPK.id_A=s.id_A " +
                  "and b.PK.id_C= :idEvent";
  
          Query queryGetCompany = this.entityManager.createQuery(queryCompany);
          queryGetCompany.setParameter("idEvent",c.getID());
  
          List companyList = queryGetCompany.getResultList(); 
          //how can I get A.name A.location from this list?
  </code></pre>
  
  <p>Also, is this a good way to do my query ?</p>