Hey

Below is a EJB1.1 suggestions, which might not help you currently, but
anyway...

dan benanav wrote:
> Suppose that Act is a class which needs to maintain a reference to an
> instance of type Trans.  Suppose that Join and Split are subclasses of
> Trans and the the Act reference can be either a Join instance or a Split
> instance.   I am having trouble implementing the beans for this
> relationship.
>
> The following are the classes I am interested in.
>
> public interface ActHome extends EJBHome{ \\.... }
> public interface Act extends EJBObject
> {
>     public Trans getTrans() throws RemoteException;
>     public void setTrans(Trans t) throws RemoteException;
>     \\......
> }

In EJB1.1 you would typically make use of the new environment resource
functionality. The relevant homes would be bound in Act's java:comp/env
context so they're available from there.

A couple of different approaches are now possible:
a) Add a getType to Trans which returns the name which the object is
bound to. Do lookup of home with lookup("java:comp/env/"+transType);
b) When setTrans is called do a getEJBHome on it, and find out which
interface it implements. Then iterate through the "java:comp/env"
context and check if there's a bound home which implements the interface
you have. If so, the name to it is the "type".

b) is the same as a) but without modifying Trans.

b) relies on being able to traverse the "java:comp/env" JNDI context. I
am not sure if the EJB spec mandates which JNDI operations must be
doable on the environment context. (Vlada, Mark:I think EJB1.1 should
mandate minimum compliance implementation requirements).

HTH :-)

/Rickard

--
Rickard �berg

@home: +46 13 177937
Email: [EMAIL PROTECTED]
Homepage: http://www-und.ida.liu.se/~ricob684

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