title: Hibernate/JPA: Is it possible to retrieve heterogeneous entities in a single query?
body: <p>I have 2 entities: EntityA and EntityB.</p>
  
  <p>They are unrelated, and I cannot put them in a Inheritance tree for some restrictions out of the scope of this question.</p>
  
  <p>But I need to get in the same JPQL or HQL query a mixed List containing all the instances of both entities. Is this possible with JPA or even Hibernate directly?</p>
  
  <p>I need somethign like this:</p>
  
  <pre><code>FROM EntityA WHERE fieldA=1
  UNION
  FROM EntityB WHERE fieldB="aa"
  </code></pre>
  
  <p>Any hint?</p>