title: Hibernate EntityManager + Query Cache - "join fetch" not working
body: <p>I am trying to cache a query like this:</p>
  
  <pre><code>TypedQuery&lt;Foo&gt; q = em.createQuery(
      "SELECT foo FROM Foo foo " +
      "INNER JOIN FETCH Foo.bar "
  );
  q.setHint("org.hibernate.cacheable", true);
  </code></pre>
  
  <p>The problem is that the <code>FETCH</code> doesn't seem to have any effect when the cache is hit, i.e. the collection Foo.bar doesn't get initialized. I could iterate over the the result list and initialize all instances of the collection by hand, but that would make the whole thing even slower than without using the query cache in the first place.</p>
  
  <p>I use JBoss AS 6.0 / Hibernate 3.6 with Infinispan as cache engine.</p>
  
  <p>Curiously, according to the cache statistics I get through the JMX console, objects in Foo.bar seem to get cached, but the cache for those objects doesn't get any hits.</p>