title: Get fresh data for a list of entities
body: <p>We're using jpa with Toplink as an implementation and came up with a problem about refreshing lists of entities.</p>
  
  <p>Basically this is the scenario:</p>
  
  <pre><code>private List&lt;Entity&gt; findAll()
  {
      final String sql = "SELECT e from " + anEntityClass.getSimpleName() + " e";
      final Query query = itsManager.createQuery(sql);
      List&lt;Entity&gt; result = query.getResultList();
  
      return result;
  }
  </code></pre>
  
  <p>But if we modify the database by external means, a second call to findAll() method will return outdated information because it reuses the info stored in cache.</p>
  
  <p>One solution to this problem is to specify </p>
  
  <pre><code>query.setHint("toplink.refresh", "True");
  </code></pre>
  
  <p>So we always get refreshed data. But then we are depending on Toplink and we would face a problem if we need to change providers.</p>
  
  <p>I know that there's an entityManager.refesh() method but I've only seen it in combination with entitytManager.find() to get only one entity.</p>
  
  <p>Is there any standard way to get fresh data for a list of entities?</p>