tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laird Nelson <>
Subject JPA + EJB interaction question
Date Fri, 24 Jul 2009 20:17:10 GMT

   - I have one stateless session bean--S1--that calls another--S2--through
   S2's *local *business interface...
   - ...and if both S1 and S2 have EntityManagers injected into them (EM1
   and EM2) with the same @PersistenceContext annotation (thus referring to the
   same persistence unit)...
   - ...and if S2 does something that results in an entity becoming managed
   under EM2...
   - ...and if S2 is marked as
   @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) (and if S1 is
   marked as REQUIRED, though I suspect it doesn't matter)...
   - ...and if S2 returns that managed object to S1 (by reference, as
   guaranteed by the EJB specification)... that EM2-managed object then guaranteed to be managed in EM1's
persistence context?  May I call EM1.refresh() on it without getting an

Another way to ask this is: are EM1 and EM2 guaranteed to share a common
persistence context *by reference* in this case?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message