If I understand your objects, they are similar to
something I did:
I have a group of EJB session beans that need to be used
interchangably, without the client knowing which object
is being used.  To do this I defined a home and remote
interface in the usual way.  I then create a number of
beans that are deployed using those remote and home
interfaces.  That way, I can specify the JNDI name of
each bean at run time, create an instance of that bean
using the (shared) home interface, and call the methods
defined in the (shared) remote interface.

Does that help?
> Hello,
>
> I want to create generic code and an extensible architecture.
> I am getting stuck and I think it is not possible in the EJB model.
>
> Let�s say, I have a base class P with a method (contract) hello(). I can
> then create classes A, B, C inheriting from P and then create generic
> and extensible code using polymorphism.
>
> With Remote classes inheritance is possible, but not for Home classes.
> And of course this is a strong bottleneck, since the only way of
> creating or obtaining a handle to a EJB is through its Home interface.
>
> 1) IObject objref = initial.lookup("reference");
>
> 2)   PHome phome =
>                (PHome)PortableRemoteObject.narrow(objref,
>                                             PHome.class);
> 3) P pointer = (P)PortableRemoteObject.narrow(phome.create(),P.class);
>
> 4)   System.out.println(pointer.hello());
>
> If I use a reference to a EJB A that inherits from P, obviously I will
> get a cast exception in line 2 (PHome and AHome are not related).
>
> Is there any way to use polymorphism and generic code in the EJB model ?
>
> Regards,
>
> Pedro
>
> ===========================================================================
> 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".
>

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