Whyy don't you take a step back and create 'pure business method' interfaces:
interface PureParent {
void businessParent1() throws RemoteException;
void businessParent2() throws RemoteException;
}
Then have a child interface:
interface PureChild extends PureParent {
void businessChild3() throws RemoteException;
void businessChild4() throws RemoteException;
}
Now set up a Parent RI and Parent bean which implements the PureParent
interface. And set up a Child RI and Child bean which implements the PureChild
interface.
Of course, the Child classes inherit only the interface and not the
implementation from the Parent. You might be able to use some form of
delegation if you needed to pick up the Parent's implementation. This would
apply to the HI as well.
cc
Shelly Aggrawal wrote:
> 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".