At 1:40 Uhr +0100 31.12.1999, Frank Sauer wrote:
> Which of these classes in your hierarchy are concreet? All of them?
> I think helper classes will work fine as long as the higher levels
> in your hierarchy are abstract and will therefore not be entitybeans
> themselves.

This still doesn't solve the problem of dealing with "polymorphic"
collections.

Imagine a class model where a one-to-many association points from a
class, CFrom, to an interface, ITo, with multiple concrete
implementations, CTo1 to CToN. The best we've come up with so far is to
use association classes, CAssoc:

A CFrom instance "points to" a collection of CAssoc instances. Those
CAssoc instances in turn "point to" concrete instances of CTo1 to CToN.

The skeletal outline of the classes is something like this

class CFrom {
    string pk;
}

interface ITo {
}

class CTo1 implements ITo {
    string pk;
}

class CTo2 implements ITo {
    string pk;
}

class CAssoc {
    string pk;
    string fromPk;
    string toPk;
    string toType; // something that allows us to find the
                   // home interface associated with toPk
}

Now, to get all the ITo instances that are associated with CFrom,
something like this happens:
- Find out which concrete subclasses of ITo there are
- For each subclass, find all instances of CAssoc that are of the
appropriate toType _and_ have the fromPk of our CFrom instance.
-- For the set of found CAssoc instances find the set of corresponding
CToN instances.
- Collect the union of the found sets.


I'm sorry, but I can't provide any more specifics as I'm not deep
enough into EJB and it's not me who's got to implement this stuff...


Michael

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