Can EJBs do polymorphism? My exact question is: I have an abstract base class called BaseClass, and a bunch of subclasses, let's call them SubClass1, SubClass2.... All classes have a method execute(). I used to have Java code doing this: BaseClass bc; bc = (BaseClass)Class.forName(subClassName).newInstance(); bc.execute(); When the parameter "className" is the qualified path of any of the subclasses, then by calling bc.execute(), that particular subclass's execute() method is actually run. By doing this, I don't have to know exactly which subclass it is but run its execute() method. Can EJB do the same thing? The way EJB obtains a home interface doesn't seem to allow me to Cast an object of subclass into the base class's home interface like below. I got an java.lang.ClassCastException. Object objref = initialContext.lookup(subClassJNDIName); (BaseClassHome)PortableRemoteObject.narrow(objref, BaseClassHome.class); So Basically how can I use EJB to achieve the same thing as my old code? Any help is appreciated. Li ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
