users@glassfish.java.net

EntityManagerWrapper not Serializable....

From: Erik Brakkee <erik.brakkee_at_gmail.com>
Date: Thu, 29 Jul 2010 21:59:43 +0200

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