これはコールリーク接続を挿入しますか
EntityManagerFactory emf = Persistence.createEntityManagerFactory("foo");
EntityManager em = emf.createEntityManager();
transaction = em.getTransaction();
transaction.begin();
try {
transaction.begin();
// insert call goes here
em.flush();
transaction.commit();
} catch (Exception e) {
if (transaction != null && transaction.isActive()) {
transaction.rollback();
}
} finally {
if (em != null) {
em.close();
emf.close();
}
}