To allow for situations where we do not require the services offered by an EJB 3 container but would like to use the persistence model, the Java Persistence API provides application-managed entity managers. Typically a Java application, such as a Swing program, would make use of an application-managed entity manager. These standalone Java applications are referred to as Java SE (Standard Edition) applications. Application-managed entity managers can also be used in servlets.
With application-managed entity managers, the application manages the entity manager's lifecycle. Container-managed entity managers normally use JTA (Java Transaction API) transactions and while it is possible to use JTA transactions with application-managed entity managers, normally resource-local transactions are used. An API, the EntityTransaction
interface, is provided for resource-local transactions. This interface provides methods for beginning, committing and rolling back transactions...