How about merging both beans into a single bean and then defining
a recursive one-to-many relationship between the bean and itself?

J. Matthew Pryor wrote:
> Hi,
>
> I can think of a whole lot of reasons why I can't do this, but lets say I
> want to try.
>
> Does anyone have any thoughts on how to get CMP EJBs to participate in
> Polymorphic relationships.
>
> Lets say I have ContainerBean & ContaineeBean
>
> I have a relationship based on the fact that a Containee is contained in
> zero or one containers, but a container can contain 0..N Containees &
> Containers (i.e. a hierarchy)
>
> So the "containee" role may point to zero or more ContainerBeans or
> ContaineeBeans (or a combination of both which is actually what I want)
>
> Even if a have ContainerBean extend from ContaineeBean, I am not sure I can
> make this work.
>
> My guess is I have to spoof it by actually specifying to different
> relationships and then writing code to "merge" them at runtime.
>
> I have thought of ways I might use XDoclet or other template systems to help
> in generating the wrapper code, making them essentially bean managed
> relationships
>
> This is probably far too OO to try & do with EJB but I am interested in
> people's thoughts on the topic and possibly any other discussions people
> know of
>
> I imagine it is possible to do my simple example some other way to avoid the
> problem, but lets say that I really want the feature; mostly I want it to
> support code reuse & EJB implementation inheritance.
>
> Thanks,
> Matthew
>
> ===========================================================================
> 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".
>
>


--
_______________________________________________________________________________

Evan Ireland            Sybase EAServer Engineering         [EMAIL PROTECTED]
                           Wellington, New Zealand                +64 4 934-5856

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