Floyd Marinescu wrote:

> Hi everyone,
>
>    I am trying to think of the most efficient way to list data on the client
> end (html) that is the result of a "join" in between two EJB's.
>    ie: suppose I have a page that lists details about cars. In the backend
> I have a car entity bean, and a car manufacturer entity bean. The two are
> connected by a manufacturer foreign key stored in the car entity bean.
>
>    Now I want the web page to list each car and the "name" of the
> manufacturer.
>
> <snipped solutions>
>
>     This must be a common enough usecase in J2EE programming that someone must
> have thought of this before, can anyone suggest a clean solution to this
> problem?
>

I agree with you, and I don't understand how this problem isn't described in the
specs. All I found in the specs is this:
"The Container must also be capable of persisting references to enterprise beans�
remote and home interfaces (for example, by storing their handle or primary key)."

So, IMO, a reference to an entity bean remote interface should be saved in the DB as
the primary key of the bean. This should be done by the container. So, in your case,
the Car bean should have a CMP field which is a reference to a Manufacturer bean, and
the reference should automatically be transformed to/from the Manufacturer's primary
key.
Even if it's not provided by the CMP manager, you could do it yourself, and switch to
CMP later, without breaking your interfaces. With some code or deployment tunings,
you could be able to specify if the Manufacturer's state should be loaded or not when
the Car's state is loaded.

I recommend you Inprise Application Server, which handles such cases correctly, and
even contains an example with this feature.

just my two eurocents.

JB.

>
> thanks in advance,
>
> Floyd
>
> ===========================================================================
> 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".

--
Jean-Baptiste Nizet
[EMAIL PROTECTED]

R&D Engineer, S1 Belgium
Excelsiorlaan 87
B-1930 Zaventem
+32 2 714 45 42

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