Using Entities in Java EE Applications
  • EntityManagers are obtained via "Dependency Injection"
  • Within the context of an EJB method, the JTA transaction will be started for you
EJB Example  
  • In a servlet environment, you must initiate the JTA transactions yourself (a servlet filter maybe)
Servlet Example