Uploaded image for project: 'Product Technical Learning'
  1. Product Technical Learning
  2. PTL-958

AD183-28: Incorrect SFSB annotations in example

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • AD183 - EAP 7.0 1 20171212
    • AD183
    • None
    • ILT, ROLE, VT
    • en-US (English)

      URL:
      Reporter RHNID: grega.bremec@softergee.si
      Section: - Describing Session Beans
      Language: en-US (English)
      Workaround:

      Description: The SFSB code snippet in the example shows a request scoped stateful session bean.

      Granted that the two annotations address different components (one is from CDI and one is from EJB), but the combination of annotations does not make any sense.

      There was a discussion about that (and a similar, but not the same, bug) regarding JB225 some years ago, when we erroneously assumed the same instance of a SLSB would be associated with a client request.

      The conclusion of that discussion was that CDI can not enforce the behaviour of the EJB subsystem and vice-versa, and as such, any mismatches between the annotations are a logical error in the application.

      In this case:

      @RequestScoped
      @Stateful
      @Named("hello")
      public class Hello {
      ...
      }

      CDI would be required to create a new instance (and hence, reference) of the "hello" bean upon each request, so the state established previously would remain in another instance of the EJB.

      The correct scope annotation would therefore be either session or conversation.

            rht-zgutterman Zachary Gutterman
            gregab@p0f.net Grega Bremec
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: