Chapter 6. Entity Manager

In this chapter we will take a more detailed look at the entity manager. In particular we will cover:

  • Application-managed entity manager

  • Container-managed entity manager

  • Entity manager methods

  • Cascade operations

  • Extended persistence context

  • Entity lifecycle callback methods

  • Entity listener classes

We have already seen examples of the entity manager in previous chapters. All these examples made use of container-managed entity managers, where an entity manager's lifecycle is managed by the EJB 3 container. 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. We will first take ...

Get EJB 3 Developer Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.