Created
September 28, 2013 13:44
-
-
Save craigew/6742218 to your computer and use it in GitHub Desktop.
Method to allow for query on DataAccess
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected List<T> queryString(String sql){ | |
EntityManagerFactory factory = Persistence.createEntityManagerFactory("JPAIntroduction"); | |
EntityManager em = factory.createEntityManager(); | |
List<T> results= em.createQuery(sql).getResultList(); | |
em.close(); | |
factory.close(); | |
return results; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment