1 Reply Latest reply on Jun 29, 2007 9:49 AM by waynebaylor

    Can a EJB3 stateless bean extend another stateless bean?

    nsmith80

      Let me give you a brief background on the task I'm trying to accomplish before my questions. I'm trying to set up a hierarchical user structure. This is the structure top down: Belo Admin, Regional Admin, DMA Manager, and DMA user. Each user needs to inherit the functions of the users below it.

      Question 1: Can a session bean extend another session bean?

      Question 2: Can a remote interface extend another remote interface?

      My thought was that, if possible, I could for instance create my base DmaUser Remote interface and implement it in the DmaUserBean. Then I would have the DmaManager Remote interface extend DmaUser Remote interface and DmaManagerBean extend the DmaUserBean. Then work my way up the chain until the Belo Admin inherits all the properties of the user's below it. I've checked several different resources and perused the web looking for an answer without much luck.

      The only other possibility that I found was the @EJB injection, but I'm not sure that would give me the results I'm looking for.

        • 1. Re: Can a EJB3 stateless bean extend another stateless bean?
          waynebaylor

          i think inheritance will work for both session beans and interfaces. as far as i know, you just have to make sure to annotate the sub-interface with @Remote/@Local even if the super-interface has it. ditto with the session beans, except using @Stateless/@Stateful.

          you should put together a quick test though to make sure it will suit your needs.