title: How to combine JDBC statement with EntityManager?
body: <p>I created the entity classes of my database with NetBeans. I believe I know how to use EntityManager</p>
  
  <pre><code>(Class) db.createNamedQuery(String name);
  </code></pre>
  
  <p>but I don't know where to put the statement (database link, login, password) so I learned how to query with</p>
  
  <pre><code>(JDBC4ResultSet) statement.executeQuery(String query);
  </code></pre>
  
  <p>but it returns the set which I don't know how to transform into Entity class... something like</p>
  
  <pre><code>(Class) statement.execureQuery(String query).toEntity(Class);
  </code></pre>
  
  <p>would be nice. ;-)</p>