title: Multi Tenancy Support with JPA 2 and EJB 3
body: <p>I am trying to change Java EE web application that use JPA2 and EJB3 to support multi tenancy.</p>
  
  <p>I would like to make the setting of the current tenant id before my application request start so the application itself will not have to know it is used in multi tenant environment.</p>
  
  <p>I am trying not to use vendor specific feature to allow myself deploy the application to both on-prem container and google AppEngine. That been said, if I can use vendor specific feature from external place such as servlet filter this will be great solution.</p>
  
  <p>I am currently using Glassfish 3.1 as container and Hibernate 4.0 as JPA2 provider.</p>
  
  <p>Sample code will be much appreciated.</p>
  
  <p>Thank you,
  Ido.</p>