4 Replies Latest reply on Jun 19, 2009 5:00 PM by mangelo123

    Cannot get Bijection to work!

    mangelo123

      I am trying to in/outject a stateful session bean so that it retains its value between page hits. The stateful bean looks like this:


      @Name("userInfo")
      @Stateful
      public class UserInfoBean implements UserInfo {
      ...
      



      The bean that I am trying to inject it into looks like this:


      @Name("setListDragDrop")
      public class SetListDragDropBean implements SetListDragDrop {
      
           @Logger private Log log;
           
           @In(value="memberGroupHasSongHome", create=true)
           MemberGroupHasSongHome groupSongsHome;     
      
           @In
           private EntityManager entityManager;
           
           @In(create=true) @Out
           UserInfo userInfo;
      ...
      



      This isn't the actual way that I want it. This is just a test, but I cannot get an injected bean to show the value that it had previously. I am trying to retain some user info in a stateful bean after a successful log in. I am trying to implement this in the Authenticator class, but I can't anything to work.


      TIA.



        • 1. Re: Cannot get Bijection to work!
          jeanluc

          I don't completely understand what you're trying to do. If you want a bean that retains its value between page hits, why not simply identify whether page hits refers to a conversation or the entire session than scope your SFSB accordingly? There's no need to weave it in and out of components to preserve it further.

          • 2. Re: Cannot get Bijection to work!
            mangelo123

            In the above scenario when I come back to a method in SetListDragDropBean why wouldn't userInfo already be created and have the values from the previous invocation? Since userInfo is a Stateful bean I assumed it would.

            • 3. Re: Cannot get Bijection to work!
              jeanluc

              It should if the bean is properly scoped. By default, an SFSB is bound to the conversation. What I guess is that in your case the conversation ends before the second invocation so the previous invocation happened in a different conversation. Check the boundaries of the conversation.

              • 4. Re: Cannot get Bijection to work!
                mangelo123

                That's another thing that confuses me. I understand having to scope a component if JSF or another front end would have to access it, but for one EJB to access another that shouldn't be the case correct? I should just be able to inject it with @EJB or the SEAM @In / @Out and voila!


                I did try the scoping anyway, but that did not work. I tried @Scope(ScopeType.SESSION)


                Thanks for your input.