You don't need to use inheritance in the interfaces to use inheritance in
the bean, but it looks like inheritance in the bean won't work all that well
either.  I'm not sure what the difference in the ParentPK and ChildPK are,
but this seems to me to indicate that inheritance might not be the right
relationship between Parent and Child.  This looks like a good time to apply
composition to the problem instead of inheritance.

Cheers
Jay Walters

-----Original Message-----
From: Shelly Aggrawal [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 31, 2001 4:02 AM
To: [EMAIL PROTECTED]
Subject: Re: Inheritance : Once Again:


What about the ejbFindByPrimaryKey and ejbCreate method problems, if the
ParentPk and the ChildPk are different.

----- Original Message -----
From: Carlos Otero Barros <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 31, 2001 1:59 PM
Subject: Re: Inheritance : Once Again:


Hi Shelly.

I don´t see any problem inheriting the EJB class (the bean class). But
iheriting HI or RI you could get the deploy tool in trouble. A very
simple-minded deploy tool should expect the direct ancestor of a HI be the
EJBHome interface an so the RI. I´m not sure this is going to work on every
appserver, specially with J2EE Reference Implementation.

----- Original Message -----
From: "Shelly Aggrawal" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 31, 2001 8:30 AM
Subject: Inheritance : Once Again:


> Hi All,
>  I know that we have visited Inheritance a lot of times in this mailing
> list.. but the following seems to be still unconfirmed:
>
> Suppose i have a parent entitybean, say ParentBean. The RI and Home I
Parent
> and ParentHome. the PK type is ParentPK...
> I understand that the only way to inherit an entity bean is by inheriting
> the interfaces and classes separately. So, i have a child which is
>
> public interface Child extends Parent{
>     pubic void AChildMethod();
> }
>
> public class ChildBean extends ParentBean{}
>
> I do not see a problem with inheriting the remote interface and with the
> corresponding methods in the bean class. But can I, and is it valid, to
> inherit the home interface... considering the fact, that the ParentHome
will
> have a
> public Parent findByPrimaryKey() while the child will need to have a
> public Child findByPrimaryKey() ... this is neither overriding nor
> overloading... and hence will give a compilation error. A no argument
> create() will also give rise to the same problem.  So I gather that the
> child can inherit the remote interface but not the home interface.
> So, Parent's home is something like this
> public interface ParentHome  extends javx.ejb.EJBHome{
>     public Parent findByPrimaryKey() ;
>     public Parent create();
> }
>
> and the Child's home would be
> public interface ChildHome  extends javx.ejb.EJBHome{
>     public Child findByPrimaryKey() ;
>     public Child create();
> }
>
> Now, what happens in the BeanClass... I derive the ChildBean from the
> ParentBean
> public class ParntBean implements  javax.ejb.EntityBean{
>     public ParentPK ejbCreate(){
>         // return ParentPk
>     }
>     public ParentPK ejbFindByPrimaryKey(){
>         // return ParentPk
>     }
>
> }
>
> public class ChildBean extends ParentBean{
>     public ChildPK ejbCreate(){
>         // return ChildPk
>     }
>     public ChildPK ejbFindByPrimaryKey(){
>         // return ChildtPk
>     }
> }
> The compilation of ChildBean class will give errors. I may be able to
bypass
> this by  declaring the ParentPK as the return type but in this case ejbc
> will give errors......
>
> Is this a restriction with Entity beans.. or is there some way to achieve
> inheritance.
> Any inputs will be most helpful.
>
> And also should the ChildPk be derived from ParentPK as in
> public class ChildPK extends ParentPK{
>     int childId;
> }
>
> Thanks and Regards,
> Shelly
>
>
>
>
>
>
> About Inheritance in EJBs. I am presenting my views and doub
>
>
===========================================================================
> 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".

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