title: Application vs Container Managed EntityManager
body: <p>I am currently having a problem with understanding a concept of JPA.</p>
  
  <p>I am currently using/developing recent EclipseLink, Glassfish, Derby database to demonstrate a project.</p>
  
  <p>Before I develop something in much bigger picture, I need to be absolutely sure of how this PersistingUnit work in terms of different scopes.</p>
  
  <p>I have bunch of servlets 3.0 and currently saving user's associated entity classes in the request.session object (everything in the same war file). I am currently using Application-managed EntityManager using EntityManagerFactory and UserTransaction injection. It works smooth when it is tested by myself. The different versions of entities occur when 2 people accessing the same entities at the same time. I want to work with managed beans cross the same WAR, same persistence unit if possible.</p>
  
  <p>I have read <a href="http://docs.oracle.com/javaee/6/tutorial/doc/bnbqw.html">http://docs.oracle.com/javaee/6/tutorial/doc/bnbqw.html</a> and bunch of explanations of those scopes which don't make sense at all for me. </p>
  
  <p><strong>Long story short</strong>, what are the usage and difference of app and container managed EntityManagers?</p>