title: Potential Issues with creating EntityManager per HttpSession in web application
body: <p>In one of the application ,I saw Entity Manager is created 'per user HttpSession' and EntityManagerFactory is created only once. </p>
  
  <p>Spring or EJB is NOT used in application.
  Entity manager is cached in http session and closed when session invalidated.</p>
  
  <pre><code>public EntityManager getEntityManager() { 
      //Logic to get entity manger from session
      //If its present , then return 
      //Else create new one , entityManagerFactory.createEntityManager();
      //Put it into session and then return.
      //Returned entity manager is not closed by dao methods , 
      //but clear() is invoked
  }
  </code></pre>
  
  <ol>
  <li>What are potential problems with this design.</li>
  <li>What if 100K Users logged in into application simultaneously, will we run out of jdbc connections ?</li>
  <li>Does every entity manager has a separate JDBC connection associated with it?</li>
  </ol>