1 Reply Latest reply on Mar 16, 2003 8:48 AM by draftdog

    CMR many-2-many: howto add/remove beans ?

    draftdog

      hi,

      does anyone here has any experience with many-to-many relationships managed by the container (EJB2.x) ?

      Jboss creates and manages the JOIN table for you, but I wonder what happens when you want to do destructive operations on these relations, for example:

      Suppose you have UserEJB and ProjectEJB:
      1. users work on several projects, and
      2. projects can have several users working on them

      this is many-to-many

      how would you add a user to a project in this case ? would you simply call project.getUsers(), get the Collection and add a user bean there ? will JBoss handle this correctly by updating the JOIN table ?

      thanx
      Wouter.

        • 1. Re: CMR many-2-many: howto add/remove beans ?
          draftdog

          okay.. so I found the time to do a little test and it seems that the container handles the many-to-many relation: the collection returned can be used directly since it is live (local interfaces EJB2.x), the JOIN table will be updated accordingly

          so the answer to my previous email would be: yes

          pretty great ;-)