Why would you wanna serialize EntityManager?
Simply mark it as transient, and get it re-injected when you need it.
All information that existed in the PersistenceContext would be lost. I think I can live with that as long as no extended PersistenceContext is used. I wonder why I seldom see examples where the injected EntityManager is marked transient...
Thanks for your suggestion!
Imo, extended PC should work, even if you mark it transient, as it should be handled by the container.
(but I'm no JPA / EJB3 expert ...)