ストアドを叩きたい場合など、Connectionを直に使用したい場合、どうすればよいか?
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | EntityManagerFactory emf; try {   // persistence.xml の   // persistence-unit name="名称" の名称を引数にする   emf = Persistence.createEntityManagerFactory("名称"); } catch (Exception e) {   throw new ExceptionInInitializerError(e); } EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); Connection connection = em.unwrap(Connection.class); ... em.getTransaction().commit(); | 
なんでこんなに回りくどいん?
