HibernateHelper.save(this);
Set objects = new LinkedHashSet(); objects.add(child); objects.add(this); HibernateHelper.save(objects);
  public Stem addChildStem(String extension, String displayExtension)     throws  InsufficientPrivilegeException,            StemAddException   {    StopWatch sw = new StopWatch();    sw.start();    try {      validateName(extension);      validateName(displayExtension);    }    catch (IllegalArgumentException eIA) {      throw new StemAddException(eIA.getMessage());    }    PrivilegeResolver.getInstance().canSTEM(      //GrouperSessionFinder.getRootSession(), this, this.s.getSubject()      this.s, this, this.s.getSubject()    );    try {      Stem ns = StemFinder.findByName(        this.s, constructName(this.getName(), extension)      );      throw new StemAddException("stem already exists");    }    catch (StemNotFoundException eSNF) {      // Ignore.  This is what we want.    }    try {      _initializeChildGroupsAndStems(this);    }    catch (HibernateException eH) {      throw new StemAddException(eH.getMessage());    }    try {      Stem child = new Stem(this.s);      // Set naming attributes      child.setStem_extension(extension);      child.setDisplay_extension(displayExtension);      child.setStem_name(         constructName(this.getName(), extension)      );      child.setDisplay_name(         constructName(this.getDisplayName(), displayExtension)      );      // Set parent      child.setParent_stem(this);      // Add to children       Set children  = this.getChild_stems();      children.add(child);      this.setChild_stems(children);      // Now commit to registry      HibernateHelper.save(this);      sw.stop();      EL.stemAddChildStem(this.s, child.getName(), sw);      _grantDefaultPrivsUponCreate(child);      return child;    }    catch (HibernateException eH) {      throw new StemAddException(        "Unable to add stem " + this.getName() + ":" + extension + ": "         + eH.getMessage()      );    }  } // public Stem addChildStem(extension, displayExtension)