Last active
June 24, 2016 02:10
-
-
Save thjanssen/af62a32c29b6820a66adfbdef06549f5 to your computer and use it in GitHub Desktop.
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
EntityManager em = emf.createEntityManager(); | |
em.getTransaction().begin(); | |
Author a = em.createQuery("SELECT a FROM Author a JOIN FETCH a.books WHERE a.id = 1", Author.class).getSingleResult(); | |
em.getTransaction().commit(); | |
em.close(); | |
log.info(a.getFirstName()+" "+a.getLastName()+" wrote "+a.getBooks().size()+" books."); |
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
EntityManager em = emf.createEntityManager(); | |
em.getTransaction().begin(); | |
Author a = em.createQuery("SELECT a FROM Author a WHERE id = 1", Author.class).getSingleResult(); | |
em.getTransaction().commit(); | |
em.close(); | |
log.info(a.getFirstName()+" "+a.getLastName()+" wrote "+a.getBooks().size()+" books."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment