EJB programming & troubleshooting: Can I Implement an abstract Session Bean Class?

  1. Can I Implement an abstract Session Bean Class? (2 messages)

    Hi everybody!

    Abstract Session Bean must not be declared with EJB specification (Weblogic EJBC Compiler show an error when deploy the Session Bean).

    How can I implement an abstract Session Bean without errors?

  2. A sesion bean component cannot be abstract. You don't need the spec to tell you that. Session bean instances are created by clients, and their methods are invoked. Hence, they must not be abstract.

    There is no problem with defining an abstract class that implements some of the functionality of a session bean. You just can't deploy it: you have to subclass it to provide a concrete implementation of all the methods.

  3. If you are trying to abstract behavior found in multiple session beans, you could create an abstract class an let your session beans extends from it. There is nothing to say that an EJB cannot extends an non-EJB class.

    Goes for entitybeans as well...