You definitely want at least 2 entities, but I would not recommend 3... You
will want to do a hybrid of container-managed/bean-managed persistence. The
way I've solved similar cases is by bean-managing the mapping of A to B
(using a mapping table with the PK from A and B as the fields). This works
very well, use the container to manage the "simple" fields, and just code
the updates to the mapping table.
Rick
At 02:16 PM 10/14/99 -0500, Shawn McKisson wrote:
>Pankaj Tandon wrote:
> >
> > The fact that you have defined an MxN relationship between AWARDS and
> > PEOPLE means that you will eventually need to support a method such as
> > Enumeration findPeopleForAward(Award a) ; in addition to
> > findAwardsByPerson();
> > If that is the case I think you will need an entity eJB called
> > PersonAwardBean which implements *both* these business methods and is
> > persisted in the PERSON_AWARD table.
> >
> > If however, you only need to implement findAwardsByPerson(); then you dont
> > really need the PERSON_AWARD table. You will need a foreign key in the
> > AWARDS table referecing the person table. (at db level, that's an option)
> > and will need one entity eJB for each PERSON and AWARD table, most likely
> > doing the 'join' in your session bean (The session bean will invoke finder
> > methods on each bean). Unless someone can suggest how to write an entity
> > bean for 2 tables connected by a foreign key....
>
>Ah, very helpful indeed!
>
>You are correct in proposing that what I really want is a 1 - N mapping of
>people to awards. I am going to code up the three beans, as you suggested
>in the
>latter part of your mail, and see how things go.
>
>I would still be interested to hear from anyone could suggest how to
>accomplish
>this all in one bean (which I guess is what I was (ignorantly) originally
>trying
>to do.)
>Mabye someone has an argument as to why or why not to do it that way?
>
>Thank you for your insight.
>
>--shawn
>
>===========================================================================
>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".
_______________________________________________________________
Rick Mangi Tel: (212) 972-2030
Thaumaturgix, Inc. Fax: (212) 972-2003
317 Madison Avenue, Suite 1615 [EMAIL PROTECTED]
New York, NY 10017 http://www.tgix.com
thau'ma-tur-gy, n. the working of miracles
"You can only see what you thought you knew" - j. wilson
_______________________________________________________________
===========================================================================
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".