> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Sean P.
> McNamara
> Sent: mardi 23 janvier 2001 20:41
> To: Orion-Interest
> Subject: RE: O/R mapping
>
>
>
> While I agree that the 3-table approach is not necessary to do 1-M
> mappings, and that there are performance reasons that make the 2-table
> method attractive, the 3-table method has the benefit that it doesn't
> allow the fact that the object in the M (many) position to intrude
> upon it's table structure.  While this is perhaps not completely
> germaine to EJB (I'm not so familiar with the details of the spec,) we
> have found value in the 3-table approach in general O/R use.

I guess this is a good design point; But if the client come and say
way this is so slow; I say because it use a join, ..., and this is slower
than ... ugly;

>
> If you make use of the 3-table method, the table that contains the
> row-data is then only specific to the OBJECT that is stored in the
> relationship.  For instance, if I have:
>
>    COMPANY ----------- EMPLOYEE
>            1         *
>
> in one application, and
>
>    CLIENT ------------ EMPLOYEE
>           1          *
>
> in another application, we are not forced to deal with extraneous
> columns relating the EMPLOYEE to either a COMPANY or a CLIENT (I
> realize a better model might be to have company and client both
> subclasses of EMPLOYER, or some such thing.)  This example is
> perhaps even better if we consider the use of EMPLOYEE alone without
> it's COMPANY or CLIENT relationship.
>
> Using the third table for the mapping keeps the individual component
> entities well isolated, which can be a good thing.
>
> Don't know if that was clear, but we've seen a use for the overhead of
> the 3rd table.
Yes, in your case is clear; but if I don't have this case, I don't care
about that;

The speed is very important; I love CMP; Is the most useful thing from EJB;

I believe a ejb container can do more for CMP; He can have options for
example, for this relation 1-m use only 2 tables (how I guess is very
clear);
or if I do a find, for this find use lazy loading for some cmp-field, don't
use ll
for another cmp-field; If I do a find with a lot of records returned, get
from
the database in piece of 30 records ( or something like that);
>
>
> Dumitru Sbenghe writes:
>  > SV: O/R mappingI care; If you store a 1-m relation in 3
> tables, to get the
>  > corresponding data from the third table
>  > for a PK from the first table, you must join the second table
> with the third
>  > table;
>  > A join is slower than a simple select;
>  >
>  > If you store a 1-m relation in only two table (the normal way)
> , you do that
>  > with only a simple select.
>
> ... Someone else previously ...
>  >   >
>  >   > I'd like to point out that a third table is only needed for a N-M
>  >   > (many-to-many) relationship.
>  >   > In the case of a 1-N relationship, simply have a foreign key to the
>  >   > master table.
>
> --
> Sean P. McNamara              <[EMAIL PROTECTED]>
> SOMA Technologies, Inc.         <[EMAIL PROTECTED]>
>                               <[EMAIL PROTECTED]>
>                               <[EMAIL PROTECTED]>


Reply via email to