3 Replies Latest reply on Jan 12, 2006 11:07 PM by minamoto

    Do Session Beans have to implement an interface?

    glennimoss

      I remember reading somewhere that session beans didn't need to implement any interface if you didn't want to, and that the container generates a local interface based on the public methods of the class.
      However, I can't figure out how to do this, is this feature not available anymore? Am I on crack?

        • 1. Re: Do Session Beans have to implement an interface?
          pvanonselen

          As far as I know you need an interface to be created manually and the container does not create it for your.

          If you have a nice IDE like Eclipse 3.1.1 you can extract an interface file from your session bean automatically by right clicking on the Session bean and then click on Refractor -> Extract interface. Then you can just add wour @Remote or @Local tags.

          • 2. Re: Do Session Beans have to implement an interface?
            glennimoss

            Ok, I found where I got this idea from.
            http://www.javaworld.com/javaworld/jw-08-2004/jw-0809-ejb.html

            On the first page it says:
            "In the EJB 3.0 world, all kinds of enterprise beans are just plain old Java objects (POJO) with appropriate annotations... you don't necessarily have to implement a business interface (the container can generate it for you)."

            And on the second page:
            "If it does not implement any business interfaces, a business interface will be generated using all the public methods. If only certain methods should be exposed in the business interface, all of those methods can be marked with the @BusinessMethod annotation."

            Of course I'm just noticing that this article is almost a year and a half old, so things may have changed quite a bit since then. If it has changed, does anyone know where in the spec drafts it changed? I'd be interested in the rationale behind this. I think it would be really great to eliminate the redundant (from a conceptual point of view) interface for each bean.

            • 3. Re: Do Session Beans have to implement an interface?
              minamoto

               

              "glennimoss" wrote:
              Of course I'm just noticing that this article is almost a year and a half old, so things may have changed quite a bit since then. If it has changed, does anyone know where in the spec drafts it changed?


              See the Revision History page of the EJB 3.0 Simplified API PFD (P.58). I think the Public Draft dropped the feature:

              Removed requirements for support of generated interfaces. Generation of interfaces may be supported by tools.


              Miki