2 Replies Latest reply on Jul 19, 2002 3:30 PM by alice

    CMP2 and relationship handling

    jocsch

      Hi,
      I've to objects (tables):

      group and a 1:N relationship to users

      In group I have the following methods:
      Collection getUsers()
      setUsers(Collection c)

      I wonder if it is possible to have a method like
      setUser(UserLocal). Or how can I add a single user? The only possiblity I see in the moment is to get all Users, add the new user to the collection and set the whole thing ....
      Is this the way things work?

      Thanks,

        • 1. Re: CMP2 and relationship handling
          giough

          How about a setOrganization(OrganizationLocal) method inside the the user entity?

          • 2. Re: CMP2 and relationship handling
            alice

            >I wonder if it is possible to have a method like
            >setUser(UserLocal). Or how can I add a single user? The >only possiblity I see in the moment is to get all Users, >add the new user to the collection and set the whole >thing ....
            >Is this the way things work?

            Yes.. have a method addUser(..) and inside that do getUsers().add(..)