2 Replies Latest reply on Mar 25, 2009 4:39 PM by germandev.net-seam.wje-online.de

    understanding "messages" example

    germandev.net-seam.wje-online.de

      Hi!


      I am currently working with the examples and am currently read the tutorial that describes the messages example. Even when the tutorial is quite good there are unfortunately a few parts I don't understand:


      (1)


      MessageManagerBean.java:


      @DataModelSelection
      @Out(required=false)
      private Message message;
      


        
      Why is that code block annotated with "Out"? Shouldn't there be an "In" so that the selection is injected?


      (2)
      MessageManagerBean.java:


      @PersistenceContext(type=EXTENDED)
      private EntityManager em;
      



      What does that "type=EXTENDED" do?


      (3)
      Why does the message bean have the scope "EVENT" while the messageManager bean has the scope "SESSION"? Doesn't it have the same scope as the bean it is referenced in?


      The messageManager bean has the property private Message message, and because that message property belongs to the session scoped messageManager it has the "SESSION" scope as well, doesn't it?



      Could you help me to understand these questions?


      Thank you in advance!

        • 1. Re: understanding "messages" example
          gonorrhea

          You need to read Seam in Action or the new edition of the Seam fwk book by Yuan et al...


          1) @DataModelSelection injects so you don't need @In


          2) if you don't use type=EXTENDED, the PC is scoped to the transaction.  You use type=EXTENDED for SFSB conversational modeling (w/o Seam, w/ Seam you use @In to inject SMPC)


          3) Each bean or component in Seam can have a different scope, even if it's injected into another component.


          Read the ref doc as well.

          • 2. Re: understanding "messages" example
            germandev.net-seam.wje-online.de

            Thank you for your answers!


            What I still don't understand: Why do I need a scope for an entity bean?


            Isn't an entity bean always used inside a session bean and then whould inherit that scope?



            Ron Ramirez wrote on Mar 24, 2009 21:29:


            You need to read Seam in Action or the new edition of the Seam fwk book by Yuan et al...



            I ordered them, thank you for this advice!