Or you can mark the fields as transient, so they will not be serialized.
yes, indeed that would work.
But why can I not assign my sessionScoped-Bean with
to disable passivating for the bean and hence avoid serializing for the bean and all its injected objects?
Inject the POJO x into a Stateless-EJBSessionBean y (x and y do NOT implement Seriazible), then inject y into a SessionScoped-ManagedBean z (z does implement Seriazible).
According to JSR-299 6.6.1, Stateless and singleton session beans are not passivation capable, hence I do NOT need to implement Seriazible for x and y! Am I right ??
Are there any drawbacks with this
I mean, when and why do I need serializing of beans (it makes only sense for scopes such as business-process, where server will shut down or user is logged out and want to continue a process the next time). I cannot imagine other scenarios.
What is the reason to use serializing with sessionScoped-beans?
There are applications that people run 8h/day, if they only access the page once in the morning and once in the afternoon, it makes sense to serialize the session. I have disbled passivation on some JBoss servers because a 3rd party lib had some annoying serialization deps that lead to CNFE:s but that doesn't of course change the CDI passivation requirements.