title: How to properly express JPQL "join fetch" with "where" clause as JPA 2 CriteriaQuery?
body: <p>Consider the following JPQL query:</p>
  <pre><code>SELECT foo FROM Foo foo
  INNER JOIN FETCH foo.bar bar
  WHERE bar.baz = :baz
  </code></pre>
  <p>I'm trying to translate this into a Criteria query. This is as far as I have gotten:</p>
  <pre><code>CriteriaBuilder cb = em.getCriteriaBuilder();
  CriteriaQuery&lt;Foo&gt; cq = cb.createQuery(Foo.class);
  Root&lt;Foo&gt; r = cq.from(Foo.class);
  Fetch&lt;Foo, Bar&gt; fetch = r.fetch(Foo_.bar, JoinType.INNER);
  Join&lt;Foo, Bar&gt; join = r.join(Foo_.bar, JoinType.INNER);
  cq.where(cb.equal(join.get(Bar_.baz), value);
  </code></pre>
  <p>The obvious problem here is that I am doing the same join twice, because <code>Fetch&lt;Foo, Bar&gt;</code> doesn't seem to have a method to get a <code>Path</code>.
  Is there any way to avoid having to join twice? Or do I have to stick with good old JPQL with a query as simple as that?</p>