public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            InfoPaciente infoPaciente;
            try {
                infoPaciente = em.getReference(InfoPaciente.class, id);
                infoPaciente.getId();
            } catch (EntityNotFoundException enfe) {
                throw new NonexistentEntityException("The infoPaciente with id " + id + " no longer exists.", enfe);
            }
            List<String> illegalOrphanMessages = null;
            List<PypAdmAgend> pypAdmAgendListOrphanCheck = infoPaciente.getPypAdmAgendList();
            for (PypAdmAgend pypAdmAgendListOrphanCheckPypAdmAgend : pypAdmAgendListOrphanCheck) {
                if (illegalOrphanMessages == null) {
                    illegalOrphanMessages = new ArrayList<String>();
                }
                illegalOrphanMessages.add("This InfoPaciente (" + infoPaciente + ") cannot be destroyed since the PypAdmAgend " + pypAdmAgendListOrphanCheckPypAdmAgend + " in its pypAdmAgendList field has a non-nullable idPaciente field.");
            }
            if (illegalOrphanMessages != null) {
                throw new IllegalOrphanException(illegalOrphanMessages);
            }
            InfoEntidades contratante = infoPaciente.getContratante();
            if (contratante != null) {
                contratante.getInfoPacienteList().remove(infoPaciente);
                contratante = em.merge(contratante);
            }
            em.remove(infoPaciente);
            em.getTransaction().commit();
        } finally {
            if (em != null) {
                em.close();
            }
        }
    }