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

Reply via email to