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....
Shawn McKisson <[EMAIL PROTECTED]> on 10/14/99 12:40:55 PM
Please respond to A mailing list for Enterprise JavaBeans development
<[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: (bcc: pankaj tandon/MIS/genco/US)
Subject: I'm not understanding EBs.
I am trying to build my first non-simple entity bean, however, I'm having
some
problems.
What I have are people and awards.
People is a simple table with only a "name" field and primary key.
Awards is a simple table with only a "name" field and primary key.
Since the relationship between people and awards is M x N, I have a
relationship
table which describes what people have which awards.
My goal is to have an EB through which I can manipulate and view the people
and
their awards.
My initial thought is to simply put a
private Enumeration awards;
as a instance variable of the PeopleBean. But I keep reading everywhere
that an
entity bean should represent 1 row of data from the data base. Placing this
enumeration in the PeopleBean would mean that it represents n rows (1 for
each
award the person has won)
The remote interface I would like to have for people is
String getName();
Enumeration getAwards();
The fact that I want an enumeration of awards back makes me think that I
should
also have an Award EB that has a finder method suck as
findAwardsByPerson();
How should I handle this situation? Is creating an AwardBean the "proper"
thing
to do?
--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".
===========================================================================
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".