Skip to content

Instantly share code, notes, and snippets.

@jyeary
Last active August 7, 2017 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jyeary/f29f777431f00425b48e2e2df329e124 to your computer and use it in GitHub Desktop.
Save jyeary/f29f777431f00425b48e2e2df329e124 to your computer and use it in GitHub Desktop.
@PersistenceUnit(unitName="SamplePersistenceWebPU")
EntityManagerFactory emf;
public Customer[] getCustomers() {
EntityManager em = emf.createEntityManager();
Query q = em.createQuery("SELECT c FROM Customer c");
List list = q.getResultList();
return list.toArray(new Customer[list.size()]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment