4 Replies Latest reply on May 9, 2008 5:20 PM by admin.admin.email.tld

    injecting org.jboss.seam.contexts.Context

    admin.admin.email.tld

      when you inject org.jboss.seam.contexts.Context interface into a SFSB, what exactly happens?


      for example:


      @In 
      Context sessionContext;
      
      sessionContext.get("NtlmHttpAuth")).getDomain();
      



      what class is implementing Context at this point in the above get method call?


      The above code works as is in my SFSB. 


      Since Context does not implement the Serializable interface, must the instance variable be set to null in the @PrePassivate method prior to passivation?


      thx.


        • 1. Re: injecting org.jboss.seam.contexts.Context
          admin.admin.email.tld

          well I just ran a test.  I have a session-scoped SFSB.  I am not setting the sessionContext variable to null in the @PrePassivate method and am not seeing any exception in the log when the ejb container passivates the SFSB instance.


          that's interesting...

          • 2. Re: injecting org.jboss.seam.contexts.Context
            admin.admin.email.tld

            javax.persistence.EntityManager does not implement the Serializable interface.


            EntityManager instance variable is not being set to null either in @PrePassivate method but no errors passivating SFSB instance.


            @In  
            private EntityManager entityManager;



            If Hibernate is the persistence provider, what class implements this interface and does it implement the Serializable interface?


            • 3. Re: injecting org.jboss.seam.contexts.Context
              matt.drees

              This works because Seam injection occurs before every method, and after the method completes, all the injected values are disinjected/nulled.


              So you don't need to worry about serializability of objects in properties annotated @In.

              • 4. Re: injecting org.jboss.seam.contexts.Context
                admin.admin.email.tld

                Matt Drees wrote on May 08, 2008 06:42 AM:


                This works because Seam injection occurs before every method, and after the method completes, all the injected values are disinjected/nulled.

                So you don't need to worry about serializability of objects in properties annotated @In.


                do you have a reference to an official doc on that?


                I'm seeing the following code on page 795 of Java Persistence with Hibernate in the RegisterBean SFSB:


                @In(create=true)
                private transient FacesMessages facesMessages;



                so why is the transient keyword there if you're right about the @In annotation?