5 Replies Latest reply on Mar 19, 2007 4:45 AM by jimknopf

    How to delete Memberships

    jimknopf

      Is it not possible to delete a Membership?

      I want to synchronized the Users of JBPM with users from another Database where are users, groups, memberships and a little more.

      In the other DB it is possible to remove and add Memberships.
      My Problem now is, i can add a Membership in JBPM but it is not possible to delete one.
      I think i can't delte it direct on the Database, because then it won't delete in the User and Group Hash-Table.

      How can i synchronize these two databases (in a fast way) every 15 Minutes?

        • 1. Re: How to delete Memberships
          jimknopf

          Come on, is there realy no one who can help me?

          I think it must be possible by deleting the Membership on the Database with this:

          "delete from org.jbpm.identity.Membership as m where m.id = ?1 "


          and delete the Membership from the User and Group Object in JBPM
          ...
          BUT
          I can't remove a Membership from a User
          the Group Objects have
          .setMemberships( memberships );
          


          but the User Objects has only .addMembership( ... )

          ------

          I didn'T find a way :(

          • 2. Re: How to delete Memberships
            olivier_debels


            Can't you let hibernate take care of this?

            I mean you can do Session.delete(membership)...

            Haven't tried it though.

            • 3. Re: How to delete Memberships
              jimknopf

              The deleting on the Database is not realy the Problem.
              The Problem is, that the Memberships are still in use by other Objects like User and Group whitch are have a Hash-Table of there memberships.

              And the User didn't have a methode to delete a Membership. Only Group have setMemberships. The User have only addMembership :(

              • 4. Re: How to delete Memberships
                olivier_debels


                I thought that doing a session.delete of a membership will also remove this membership out of the collections in user and group.

                This because the membership is a hibernate object and calling delete removes the object from the session (so also from the mapped collection in the same hibernate session).

                But like I said I didn't really try that.

                • 5. Re: How to delete Memberships
                  jimknopf

                  Thanks for the fast answer, and sorry for the delay but i was ill.
                  Hmm, after thinking a little about it, i think u are right and Hibernate will manage this for me.

                  Thank u