2 Replies Latest reply on May 7, 2008 8:56 AM by kooudy

    Stateful EJB and serialization

    kooudy

      I have a question about serialization of stateful EJB.


      What happens when bean is serialized and has references to non-serializable fields like EntityManager, Logger (apache, jboss), references to other stateful and stateless beans?


      Schouldnl't they be marked as transient?


      thanks

        • 1. Re: Stateful EJB and serialization
          skajotde

          EntityManager and beans are marked with standard EJB3 annotations: @PersistenceContext and @EJB. I guess are injected after/before activation/passivation. Rest objected have to be activate/passviate in @PostActivate and @PrePassivate methods which interact with serialization). Also logger... Yes it must be transient and reload in @PostActivate/@Prepassivate (another solution is static logger which wont be serialized, but I prefer not-static)


          --
          Cheers Kamil

          • 2. Re: Stateful EJB and serialization
            kooudy

            this should be mentoined in seam examples


            thanks