public void destroy(Integer id) throws NonexistentEntityException {
   EntityManager em = null;
   try {
     em = getEntityManager();
     em.getTransaction().begin();
     Seccion seccion;
     try {
       seccion = em.getReference(Seccion.class, id);
       seccion.getId();
     } catch (EntityNotFoundException enfe) {
       throw new NonexistentEntityException(
           "The seccion with id " + id + " no longer exists.", enfe);
     }
     em.remove(seccion);
     em.getTransaction().commit();
   } finally {
     if (em != null) {
       em.close();
     }
   }
 }
 public void edit(Seccion seccion) throws NonexistentEntityException, Exception {
   EntityManager em = null;
   try {
     em = getEntityManager();
     em.getTransaction().begin();
     seccion = em.merge(seccion);
     em.getTransaction().commit();
   } catch (Exception ex) {
     String msg = ex.getLocalizedMessage();
     if (msg == null || msg.length() == 0) {
       Integer id = seccion.getId();
       if (findSeccion(id) == null) {
         throw new NonexistentEntityException("The seccion with id " + id + " no longer exists.");
       }
     }
     throw ex;
   } finally {
     if (em != null) {
       em.close();
     }
   }
 }