title: JPA query "optimization"
body: <p>I have just turned on query logging in the database behing JPA (EclipseLink) and have witnessed the horror of JPA "optimization" and "caching".</p>
  
  <p>For example, doing a simple JPA query like this:</p>
  
  <pre><code> SELECT p FROM Picklist p;
  </code></pre>
  
  <p>... will cause a JPA to do a million of SQL queries to database (one query for each record, so select * from picklist where id=[...]). And Picklist is a simple entity!</p>
  
  <p>Why doesn't it do a SELECT * FROM Picklist and just does everything else (filling the Persistance Context or whatever) in memory?</p>
  
  <p>Does it need some special switch to tell it to do this? Why is it working like this?</p>