I'm having a strange situation where the injection of some Stateless EJBs into a Stateful prevents some lazy properties to be resolved by the Extended Persistence Context into a long running conversation in Seam 2.2.2
From what I've discovered, it seems that any find executed in a Persistence Context of a Stateless EJB injected into a Stateful one causes the clear() method to be called on the Extended Persistence context.
The methods are annotated with @TransactionAttribute(TransactionAttributeType.SUPPORTS)
Example:
@Stateful
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public class BeanA {
@PersistenceContext(type = PersistenceContextType.EXTENDED) EntityManager em;
@EJB BeanB beanB;
public MyClassA find(Long id) {
return em.find(MyClassA.class, id);
}
public void method() {
MyClassA a = find(2);
em.contains(a); // true
beanB.find("myId"); // Now every object returned from A's EM are detached.
em.contains(a); // false
}
}
@Stateless
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public class BeanB {
@PersistenceContext EntityManager em;
public MyClassB find(String id) {
return em.find(MyClassB.class, id);
}
}
Can anyone confirm me this?