6 Replies Latest reply on Jun 10, 2016 9:44 AM by Stephan Knitelius

    Are transient dependencies re-injected after it awakes from passivation?

    Cay Horstmann Newbie
      I am using Weld in GlassFish and, like everyone else, am running into the error "Managed bean declaring a passivating scope must be passivation capable." Section 6.6.1 of the CDI spec says "A managed bean is passivation capable if and only if the bean class is serializable and all interceptors and decorators of the bean are serializable."

      Fair enough, so I make my bean serializable.

      Of course, in every one of my examples, I have a dependency to a non-serializable field:

      - A stateless session bean (JSF+CDI+SLSB)
      - An entity manager factory and a UserTransaction (JSF+CDI+JPA)
      - A data source (JSF+CDI+JDBC)

      So, I make the field transient, and it all works fine. Until, I suppose, my bean is being passivated and reactivated. Will transient fields be re-injected? The spec seemed to be silent on this issue; maybe this is dealt with elsewhere in the EJB spec?

      I sure hope so, because otherwise I can't use JSF+CDI+JDBC or JSF+CDI+JPA or JSF+CDI+SLSB, which really would be a big limitation. The original Seam usecase (JSF+CDI+SFSB) does work, of course, because all SFSB are passivatable.

      Thanks,

      Cay