4 Replies Latest reply on Sep 6, 2010 5:48 AM by pmuir

    Possible bean types of an EJB 3.1 SFSB

    asiandub

      hi there,


      I'm struggling over this part of the JSR 299 reference (chapter 2.2)



      Meanwhile, this session bean has only the local interfaces
      since the bean class is not a client-visible type.
      BookShop
      and
      Auditable,
      along with
      Object,
      as bean types,


      @Stateful
      public class BookShopBean
      extends Business
      implements BookShop, Auditable {
      ...
      }






      So - in my understanding of EJB 3.1 we can make the following assumptions:





      • BookshopBean implements two interfaces, so it's not a no-interface-view

      • BookShop and Auditable can (but don't need to be) annotated with either @Local or @Remote




      I would expect some sort of container error message if neither BookShop nor Auditable are @Local or @Remote, but I'm not sure. Can anyone clarify on this?


      And, the real question: Why is Object among the bean types, but not Business?


      Cheers,


      Jan

        • 1. Re: Possible bean types of an EJB 3.1 SFSB
          asiandub

          I found that in the JSR 299 spec (3.2.2. Bean types of a session bean):





          The unrestricted set of bean types for a session bean contains all local interfaces of the bean and their superinterfaces. If
          the session bean has a bean class local view, the unrestricted set of bean types contains the bean class and all superclasses.
          In addition, java.lang.Object is a bean type of every session bean.
          Remote interfaces are not included in the set of bean types.


          Putting it all together:





          The unrestricted set of bean types for a session bean contains all local interfaces of the bean and their superinterfaces.




          • BookShop, Auditable




          If
          the session bean has a bean class local view, the unrestricted set of bean types contains the bean class and all superclasses.


          • (Not the case)




          In addition, java.lang.Object is a bean type of every session bean.


          • Object




          Remote interfaces are not included in the set of bean types.


          • (Not the case)






          • 2. Re: Possible bean types of an EJB 3.1 SFSB
            pmuir

            Jan Groth wrote on Aug 24, 2010 16:57:


            hi there,

            I'm struggling over this part of the JSR 299 reference (chapter 2.2)


            Meanwhile, this session bean has only the local interfaces
            since the bean class is not a client-visible type.
            BookShop
            and
            Auditable,
            along with
            Object,
            as bean types,


            @Stateful
            public class BookShopBean
            extends Business
            implements BookShop, Auditable {
            ...
            }




            So - in my understanding of EJB 3.1 we can make the following assumptions:




            • BookshopBean implements two interfaces, so it's not a no-interface-view

            • BookShop and Auditable can (but don't need to be) annotated with either @Local or @Remote




            I would expect some sort of container error message if neither BookShop nor Auditable are @Local or @Remote, but I'm not sure. Can anyone clarify on this?


            This sounds like a reasonable error (not required by the EJB spec that I know of). Open a thread on the JBoss EJB3 forum, and lets see what they say. Can you link it back here?



            And, the real question: Why is Object among the bean types, but not Business?


            Everything in Java is rooted in Object, including interfaces.

            • 3. Re: Possible bean types of an EJB 3.1 SFSB
              asiandub

              Everything in Java is rooted in Object, including interfaces.

              I had the vague idea that this is true (smiley)


              My question rather was: If the hierarchy is
              BookShopBean - Business - Object, then why didn't Business make it into the list of bean types?


              From my understanding the answer is: Object is a bean type because it superclasses the interfaces BookShop and Auditable, but not because it superclasses BookShopBean.


              Correct?


              • 4. Re: Possible bean types of an EJB 3.1 SFSB
                pmuir

                Jan Groth wrote on Sep 02, 2010 02:25:


                Everything in Java is rooted in Object, including interfaces.

                I had the vague idea that this is true (smiley)

                My question rather was: If the hierarchy is
                BookShopBean - Business - Object, then why didn't Business make it into the list of bean types?

                From my understanding the answer is: Object is a bean type because it superclasses the interfaces BookShop and Auditable, but not because it superclasses BookShopBean.

                Correct?




                Exactly right :-)