BMP relationships

Janne Mattila <[email protected]>
Newsgroups gmane.comp.java.sun.ejb.general
Message-ID <LISTSERV%[email protected]>
Hi,

what's the correct way to handle BMP relationships? I have a scenario:

Cd {
  private Artist artist;
  private boolean artistLoaded;

  setArtist(Artist);
  Artist getArtist();
}

Artist {
  private Collection cds;
  private boolean cdsLoaded;

  setCds(Collection cds);
  Collection getCds();
}

Now, I would implement this so that the relationship fields (Cd.artist and
Artist.cds) are lazy loaded. Calling set() -methods would update both the
object and the parameter object, ie. bornInTheUsa.setArtist
(bruceSpringsteen) would update both bornInTheUsa.artist field AND
bruceSpringsteen.cds collection (otherwise bruceSpringsteen will have
invalid state after the call).

Is this the right way to go? Plus, can I trust that in clustered
environment also EJB's in other instances are updated? So that there is not
an invalid artist bean in some instance having bruceSpringsteen.cds missing
the bornInTheUsa?

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[email protected] and include in the body of the message "help".
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.