Discussions

EJB design: Session Bean extends another session bean

  1. Session Bean extends another session bean (2 messages)

    Recently, I was observing a software system and found that in a couple of places Statless SessionBeans extend other Stateless SessionBeans.

     Is this a good design ? What are the advantages and disadvantages of this approach ? What special issues should be kept in mind if such a design is required ?

     I somehow feel that such an extension design is not a good practice. I could be wrong though.

     Please share your comments.

     Kiran
  2. Probably the trying to keep the LOC to a minimum as statlessbeans implement some standard callback methods extending the beans means less typing
  3. Actually this is not the only motivation ! Polymorphic beans come in handy in a lot of cases; for example if you have some sort of event handler mechanism in your app implemented as session beans, would you rather code to each bean separately each with a different interface or would it be cleaner and better to code a single interface polymorphically that is fronted by a factory and have you EJB client code implementation agnostic?