title: Java EE Session Management Between Web & EJB Tier
body: <p>I have a Java EE application consisting of 1 web module and 1 EJB module. Inside my EJB module I have a stateful session bean containing my business logic.</p>
  
  <p>What I would like is:</p>
  
  <p>When a user logs in to my web application and creates a new session in the web tier I want that user to be assigned an instance of my session bean.</p>
  
  <p>At the moment a session is being created in the web tier as expected but I am unsure about how to map the session in the web tier to a new EJB session each time. Currently I am invoking my EJB from my Servlet meaning that only 1 instance of the bean is being created. I am trying to get a 1-1 mapping between web sessions and sessions in my EJB layer.</p>
  
  <p>I know this could be achived easily using application clients but any advice / design patterns on how I could achive this in the web tier would be greatly appreciated.</p>