public void create(Depto depto) throws PreexistingEntityException, RollbackFailureException, Exception {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Area areaareidArea = depto.getAreaareidArea();
            if (areaareidArea != null) {
                areaareidArea = em.getReference(areaareidArea.getClass(), areaareidArea.getAreidArea());
                depto.setAreaareidArea(areaareidArea);
            }
            em.persist(depto);
            if (areaareidArea != null) {
                areaareidArea.getDeptoCollection().add(depto);
                areaareidArea = em.merge(areaareidArea);
            }
            em.getTransaction().commit();
        } catch (Exception ex) {
            try {
                em.getTransaction().rollback();
            } catch (Exception re) {
                throw new RollbackFailureException("An error occurred attempting to roll back the transaction.", re);
            }
            if (findDepto(depto.getDepDepartamento()) != null) {
                throw new PreexistingEntityException("Depto " + depto + " already exists.", ex);
            }
            throw ex;
        } finally {
            if (em != null) {
                em.close();
            }
        }
    }