As the name suggests, lifecycle of container-managed entity manager is managed by the container and you can use @PersistenceContext to inject an instance of EntityManager. However it's developer's responsibility is to manage the lifecycle of entity manager e.g. create an instance from entity manager factory, associate with a transaction and close it when you are done. Sorry for doing a plug for my book, we discuss this in Chapter 9 of the book!