title: Hibernate: Query to select values from multiple tables using CriteriaQuery
body: <p>Let's say, I have a query like</p>
  <pre><code>Select a.valA, b.valB
  from tableA a join tableB b on a.joinCol = b.joinCol
  where a.someCol = 1.
  </code></pre>
  <p>I want to execute it using Hibernate (and Spring Data) in one query to the database. I know, I can write just</p>
  <pre><code>Query query = em.createQuery(...);
  List&lt;Object[]&gt; resultRows = (List&lt;Object[]&gt;)query.getResultList();
  </code></pre>
  <p>But my question would be - is it possible to do it in a typesafe way, using <code>CriteriaQuery</code> for example? The difficulty is, that, as you see, I need to select values from different tables. Is there some way to do this?</p>