title: HIbernate Entity Manager: How to cache queries?
body: <p>I am using the Hibernate 3.5.1 and EntityManager for data persistence (with JPA 2.0 and EHCache 1.5). I can obtain the query by the following code:</p>
  
  <pre><code>EntityManager em;
  ...
  Query query = em.createQuery(...);
  ...
  </code></pre>
  
  <p>Now, the problem is that EntityManager's createQuery() method returns javax.persistence.Query which, unlike org.hibernate.Query (returned by the SessionFactory's createQuery() method), does not have the org.hibernate.Query.setCacheable() method.</p>
  
  <p>How am I, then, supposed to cache the queries with EntityManager (or some other part of Hibernate)?</p>