users@glassfish.java.net

Re: EntityManagerWrapper not Serializable....

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Thu, 29 Jul 2010 13:14:13 -0700

I'm confused... why would transient fields affect serialization?

thanks,
-marina

Erik Brakkee wrote:
> Hi all,
>
>
> I am working on wicket integration with CDI and using glassfish v3 for
> testing. The issue I am running into is the fact that the
> EntityManagerWrapper is not truly Serializable. In a distributed
> context, it is necessary to be able to serialize objects that have
> contextual references. However, the EntityManagerWrapper is declared
> Serializable but has some transient fields (e.g. callFlowAgent) which
> are only initialized in the constructor but initialized nowhere else.
> As a result, the injected contextual reference to the entity manager
> (@PersistenceContext) becomes unusable after
> serialization/deserialization.
>
> This is really an annoying issue as it requires some undesirable
> workarounds. Can this problem be solved in glassfish v3?
>
> Cheers
> Erik