An EntityManager can be injected directly into an EJB using the @javax.persistence.PersistenceContext annotation. By default, a transaction-scoped persistence context is injected. You can override the default with type() attribute. When the transaction is completed, the EJB container will perform the cleanup. The extended entity manager can only be injected into a stateful session bean.

As mentioned in part 1 of the article, the EntityManager is the central service for all persistence actions. The persistence actions can be summarized as follow: