-
Feature Request
-
Resolution: Unresolved
-
Minor
-
1.1.0.Beta1
If an EntityManager resource is made available through a Producer method and the method is annotated with a passivating scope as shown below, Weld today fails
with this error message: " WELD-000053 Producers cannot declare passivating scope and return a non-serializable class"
— producer method snippet —
@PersistenceUnit(unitName = "UDEMpu")
private EntityManagerFactory emf;
@Produces
@ConversationScoped
@UserDatabase
public EntityManager create()
— producer method snippet —
The current workaround is to not use a "passivating scoped" producer method and fall back to annotating the "passivating scoped" producer field with @PersistenceContext.
Pete's idea is to enhance the user experience for a user who expects this to work by proxying the EMF and ensuring that the createEntityManager returns a proxy that is Serializable.