AFIK, inheritance is not allowed in EJB. even if allowd it would create
numerous problems. When Inheriting the Bean class, you would also have
to inherit the home and remote object, if not the container does not
know which bean to instantiate.

If you need to subclass your beans, there is probably something wrong
with the design of your application. If you have to call
createForPurpose(Purpose p), you should probably create a PurposeNameEJB
bean.

I've seen something work along similar lines however, this was not
inheritance but diferent implementations of  EntityBean
1) AccountHome.java (HomeInterface)
2) Account.java (RemoteInterface)
3) SavingsAccount.java (1st Implementation)
4) CheckingAccount.java (2nd Implementation)
(There should probably have been something like AccountInterface.java to
describe the interface)

the client then did lookups like this
Object o = ctx.lookup("accounts/savings");
AccountHome savingsHome =      (AccountHome)
javax.rmi.PortableRemoteObject.narrow(o, AccountHome.class);
savingsHome.create();

or
Object o = ctx.lookup("accounts/checking");
AccountHome checkingHome =      (AccountHome)
javax.rmi.PortableRemoteObject.narrow(o, AccountHome.class);
checkingHome.create();

so, for both SavingsAccount and CheckingAccount, Account and AccountHome
where registered as remote and home interface.

sven

Sacha Labourey wrote:

> Hello,
>
> Is it possible to have multiple server implementation of the same remote
> interface i.e.
>
>         public interface A extends javax.ejb.EJBObject {
>                 public void doSomething (...);
>         }
>
>         public interface AHome extends javax.ejb.EJBHome {
>                 public A createForPurpose (purpose Purpose);
>         }
>
> and, on the server side :
>
>         public abstract class ABasicBean implements javax.ejb.EntityBean {
>                 public String name;
>                 ...
>         } // not used....
>
>         public class ASuperBean extends ABasicBean {
>                 public String superIdea;
>                 ...
>         } // used
>
>         public class ASuperBisBean extends ABasicBean {
>                 public String superIdeaBis;
>                 ...
>         } // parallel and used
>
>         public class AMegaBean extends ASuperBean {
>                 public String anotherSuperIdea;
>                 ...
>         } // below super and used
>
> In the createForPurpose method (where should it go? in which class?), the
> choice would be done accordingly to the given parameter (enumeration). What
> about the persistance?
>
> Any comment? (I plan to use JBoss if some "interpretation" of the spec is
> needed)
>
>
> More generally, you may have some idea or pattern for my problem. I want to
> have, on the server side, several class (each extending the same root) and
> linked to a CMP entity bean. I do not want to use serialized dependant class
> because these classes may (and will) contain some logic which should not be
> made available to the client. On the other hand, the available classes
> should be quite easily extendable.
>
> Any idea? cheers,
>
>
>
>                                 Sacha
>
> ===========================================================================
> 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