4 Replies Latest reply on Jul 24, 2007 9:06 AM by jdijkmeijer

    deletion of few elements in one to many collection.

    Newbie

      Hi I'm trying to remove a few child elements from a onetomany relationship.
      like :

      for (Role r : presentRolesToRemove.keySet()) {
       focusSubject.getActors().remove(presentRolesToRemove.get(r));
      }
      

      (presentRolesToRemove being a Map<Role,Actor>)
      But doing a
      em.merge(focusSubject);
      does not remove the childs from the database. Should I do a
      em.delete(presentRolesToRemove.get(r));
      explicitely within the for-loop?
      Or is there annotation to circumvent this manual deletion?

      Thanks in advance.
      jeroen.