Book Image

EJB 3 Developer Guide

By : Michael Sikora
Book Image

EJB 3 Developer Guide

By: Michael Sikora

Overview of this book

Table of Contents (18 chapters)
EJB 3 Developer Guide
Credits
About the Author
About the Reviewers
Preface
Annotations and Their Corresponding Packages

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 a look at application-managed entity managers, before returning to entity manager topics which apply irrespective of whether an entity manager is container-managed or application-managed.

Application-managed Entity Manager

To allow for situations where...