Cedric's example is applicable when you have one to many bi-directional
relationship for Person to Address. You can have one to many uni-directional
relationship as well. In that case you need not declare CMR field in the
Address bean for Person, and your Address bean will not have abstract
methods (getPerson/setPerson)to access the CMR field Person.
Gautam
Server Team
www.pramati.com
----- Original Message -----
From: "Cedric Beust" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 11, 2001 10:58 PM
Subject: Re: relationship using EJB spec 2.0.
> > From: A mailing list for Enterprise JavaBeans development
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Alvaro Mota
>
> > For example:
> >
> > Let's say I have a Person entity bean that
> > has a one-to-many relationship with an Address
> > entity bean (A Person can have many Address
> > and an address can have for one person).
> >
> > For Person:
> >
> > in PersonEJB:
> >
> > abstract Collection getAddresses();
> > abstract void setAddresses(Collection addresses);
> > void addAddress(Address address);
>
> Actually, this should read
>
> void addAddress(AddressLocal address);
>
> > void removeAddress(Address address);
> > ArrayList getListAddresses();
> >
> > For addresses:
> >
> > in AddressEJB:
> > how make????
>
> abstract public PersonLocal getPerson();
> abstract public setPerson(PersonLocal person);
>
> You should take a look at the files generated by EJBGen
> (http://beust.com/cedric/ejbgen), it will make sense afterwards.
>
> --
> Cedric
>
>
===========================================================================
> 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".
>
===========================================================================
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".