[
https://issues.jboss.org/browse/CDI-162?page=com.atlassian.jira.plugin.sy...
]
Arne Limburg commented on CDI-162:
----------------------------------
Scott, the problem from the CDI perspective is, that the type of the EntityManager-field
is not serializable. Consider the following example:
{code}
@Stateful
public class MyStatefulEjb {
@Produces
@SessionScoped
@PersistenceContext(type = EXTENDED)
private EntityManager em;
}
{code}
From an EJB perspective this would be perfectly ok and the bean could
even be passivated, if the EntityManager is serializable and all entities are.
But a
CDI-Container would reject this declaration since @SessionScoped is a passivation-capable
scope and the EntityManager-interface does not extend Serializable.
From a CDI perspective: What would happen, if we would relax this
check? Every CDI-bean that has a field like
{code}
@Inject
private EntityManager em;
{code}
would get a contextual reference (a proxy) of an EntityManager. The EJB could be
passivated completely independent of the CDI-bean. And if the CDI-bean would access the
EntityManager, the EJB would be activated again...
Problems arise, when the CDI-bean holds a reference to an entity of the EntityManager.
This Entity would be detached after the passivation and activation of the EJB. So the
CDI-bean could never know if the entity is managed or detached, because it would depend on
whether the EJB was passivated or not...
I don't know how to solve this...
Support Extended Persistence Contexts in Managed beans
------------------------------------------------------
Key: CDI-162
URL:
https://issues.jboss.org/browse/CDI-162
Project: CDI Specification Issues
Issue Type: Tracker
Affects Versions: 1.0
Reporter: Pete Muir
Fix For: 1.1 (Proposed)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira