According to specs, Home interface is also allowed to have
superinterfaces.so inheritance is possible there also.

Regards
Ashwani Kalra
E-Comm Group
NIIT Ltd. India



> ----------
> From:         Pedro Garcia Lopez[SMTP:[EMAIL PROTECTED]]
> Reply To:     A mailing list for Enterprise JavaBeans development
> Sent:         Thursday, July 20, 2000 10:25 PM
> To:   [EMAIL PROTECTED]
> Subject:      EJB Inheritance, polymorphism and generic code
>
> 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".
>
>
>
Visit http://www.NetVarsity.com for online learning

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