0 Replies Latest reply on Sep 13, 2004 3:09 AM by davout

    CMR - adding a child - how does tyhis work?

    davout Newbie

      I'm a little confused about how a CMP entity bean that has 1-M relationship link to a subordinate entity should handle the creation new subordinate entity instances.

      For instance,...

      class Entity1Bean {
      ejbCreate(....)
      Collection getEntity2List() // returns collection of 'Entity2'
      }

      class Entity2Bean {
      ejbCreate(....)
      }

      At the moment I'm handling the creation of new Entity2 instances by....

      Entity2Home.create(....)

      However, when I then use 'Entity1Home.getEntity2List' to retrieve a list of
      linked sub entities the newly created Entity2 instance is not part of the
      list.

      I then tried adding.....

      aNewEntity1 = Entity2Home.create(....)
      Entity1Home.getEntity2List().add(aNewEntity1);

      ... and it still didn't work. What am I doing wrong?