title: best practise of creating entitymanager
body: <p>I am using resource local entitymanager with JPA 1 . What is the best practice for creating EntityManager that is</p>
  
  <ol>
  <li><p>Create do job close entitymanager everytime.(Entitymanager not heavy weight but still boring )</p></li>
  <li><p>Create a  entitymanager for every thread and store it as ThreadLocal variable and use it (a-where should i close entitymanager 
  b-Any entitystored in a session scoped bean will be a detached entity because entitymanager which entity in its persistense context closed or belong another thread now.) </p></li>
  <li><p>Store entitymanager in a session bean  and use same entitymanager during session(Sessions unawere of each others )</p></li>
  </ol>