I agree with everything that you say here, but couldn't you model Person as
an CMP Entity bean and then manage the ContactInfo using JDBC in the
standard EJB callback methods.  This gives you the benefits of CMP Entity
beans without the overhead of writing all the JDBC for the whole bean ??

Lee

_________________________________

Lee Turner
Systems Developer
_________________________________

Watt Gilchrist Ltd
Ring Road, West Park
Leeds, LS16 6RA
Tel: 0113 288 3200
Fax: 0113 275 1690
http://www.wattgilchrist.co.uk
_________________________________

> -----Original Message-----
> From: Thibault Cuvillier [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, February 01, 2001 6:49 PM
> To:   [EMAIL PROTECTED]
> Subject:      Re: bean design problem for one to many relationship
>
> Jiango,
>
> Your customer EJB is a good of an aggregate Entity.
>         - Contact is a too small cheunk of data to be implemented as an
> entity EJB.
>         - Customer and Contact is an aggregate.
>                 A contact is linked to only 1 customer
>                 A contact do not exist outside of the scope of a customer
>
> You can retreive and modify the contacts through the customer interface:
>
> public interface Customer implements EJBObject
>         public Collection getContacts();        // Collection of contacts
>         public UUID addContact(ContactInfo contact);
>         public void remContact(UUID contactPK);
>         public void changeContactType(UUID pk, String type);
>         public void changeContactInfo(UUID pk, Info type);
>         and so on
> }
>
> ContactInfo is a serializable class, but not an EJB.
>
> The choice between CMP and BMP is dependent of your application server
> persistence
> engine. If the AS can manage persistence for aggregate, use a CMP, else
> you
> need to write the code in a BMP and keep the save the ContactInfo list in
> the ejbStore method.
>
> Hope this help
> Tibo.
> >-----Original Message-----
> >From: Jianguo Wang [mailto:[EMAIL PROTECTED]]
> >Sent: Thursday, February 01, 2001 11:42 AM
> >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".

===========================================================================
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".

Reply via email to