Support declaration of an EntityManager resource through a passivating-scoped producer
method
---------------------------------------------------------------------------------------------
Key: WELD-664
URL:
https://jira.jboss.org/browse/WELD-664
Project: Weld
Issue Type: Feature Request
Components: Producers (Methods, Fields and Disposers)
Affects Versions: 1.1.0.Beta1
Environment: All environments
Reporter: Sivakumar Thyagarajan
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() {
return emf.createEntityManager();
}
--- 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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira