Hi 'Java Addicted',
        The simple answer is YES you can make an entity represent
more than one table. e.g. A USER table holds basic information about a
system user whilst the ADDRESS table may hold many addresses for that
one user in a 1-->N type relationship. Rather than creating separate
entities here you may choose to load the basic user data and all of the
relevant addresses for that user into a single USER entity bean. You can
then hold the addresses as a Java collection within the entity. The
addresses may be loaded with the user data on invocation of ejbLoad() or
you may choose to perform a 'lazy initialization' by loading the
addresses only when they are requested from the bean.

Entities should be designed as 'coarse grained' objects meaning you
should not try to described every different aspect of your business
model with an Entity bean. Instead you should try to aggregate different
elements into each entity.

NOTE: For large lists of 'index' data consider accessing the DB directly
from a Session bean. This allows you to select a particular element from
a list quickly then access the full details using an Entity Bean.

regards

DGA

-----Original Message-----
From: JavaSoft [mailto:[EMAIL PROTECTED]]
Sent: 07 February 2002 07:41
Subject: EntityBean vs table

Hello, i am new in ejb
i have basic question, does an entity bean always represents a table or
it
can represent more than 1 table ?
If yes ? in what condition i make my entity represents more than 1 table
?
can you gimme a simple example case

===
thx,
a Java Addicted

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