コード例 #1
0
 public static void closeEntityManagers() {
   EntityManager em = JpaUtil.getThreadEntityManager().get();
   if (em != null) {
     EntityTransaction transaction = em.getTransaction();
     if (transaction.isActive()) {
       transaction.commit();
     }
     em.close();
     JpaUtil.getThreadEntityManager().set(null);
   }
 }
コード例 #2
0
 public RepositorioGenerico(Class classe) {
   this.entityManager = JpaUtil.getEntityManager();
   this.classePersistente = classe;
   this.log = LogManager.getLogger(classePersistente.getName());
 }