title: JPA's EntityManager should be RequestScoped?
body: <p>I am developing a JavaEE6 based web application using JBoss7.
  In my application I am injecting the EntityManager in my EJBs as:</p>
  
  <pre><code>class ForumServiceEJB
  {
      @PersistenceContext(type=EXTENDED)
      private EntityManager em;
  
  }
  
  class TopicServiceEJB
  {
      @PersistenceContext(type=EXTENDED)
      private EntityManager em;
  
  }
  </code></pre>
  
  <p>The problem when I update some data using ForumServiceEJB's EntityManager then the changes are made into DB but TopicServiceEJB's EntityManager is not able to see those changes and the results are always fetched from Cache.</p>
  
  <p>I am using ExtendedPerssisteenceContext as My Entities contain child Entity Collections of Lazy Loading type.</p>
  
  <p>How can I use/Inject EntityManager of type ExtendedPersistenceContext and make different EntityManager in one EJB can still see the changes done by other different EJB EntityManagers?</p>
  
  <p>Somewhere I read EntityManagers should be RequestScoped objects.</p>
  
  <pre><code>public class MyEntityManagerProducers {
   @Produces @RequestScoped 
   public EntityManager createDbEm() {
     return Persistence.createEntityManagerFactory("forumDb").
            createEntityManager();
   }
  
   public void disposeUdEm(@Disposes EntityManager em) {
     em.close();
   }
  </code></pre>
  
  <p>Is it the way to go?</p>