With this design, you could easily have 2 CMP beans that do just what you
want.
Alternatively, if contact info will only be accesible thru Person, you could
store all ContactInfo
in a Person member:
(very PSEUDO pseudo-code)
public class ContactInfo extends Object {
public String UID;
public String Type;
public String Detail;
}
and in Person:
...
public Vector contactInfoCollection;
...
public addContact(ContactInfo contact);
{
contactInfoCollection.add(ContactInfo);
}
HTH
JP
> -----Original Message-----
> From: Jianguo Wang [mailto:[EMAIL PROTECTED]]
> Sent: Jueves, 01 de Febrero de 2001 14:42
> To: [EMAIL PROTECTED]
> Subject: bean design problem for one to many relationship
>
>
> Dear friends,
>
> I have a design problem about one to many relationship. Can
> anyone there give me
> some suggestions,
>
> For simplicity's sake, let's say I have two tables
> Person(UID, FirstName, LastName)
> with primary key (UID) and ContactInfo(UID, Type, Detail)
> with primary key (UID, Type).
> A person may have more than one ContactInfo. For example,
>
> A record in the table "Person" is (777, John, Smith)
> Corresponding to this person, there are two records in the
> table "ContacInfo" like
> (777, Email, [EMAIL PROTECTED])
> (777, Phone, (850)123-4567)
>
> These information are provided at a time and can be saved in
> array (mainly ContactInfo).
> When I try to insert them into database, can I implement it
> as CMP? or I have to
> implement it as BMP? If I can do with CMP, does it mean that
> I have to make a loop
> to invoke home.create(UID, Type, Detail)?
>
> Thank you very much.
>
> -John
>
> ==============================================================
> =============
> 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".