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

Introduction


Up to now our examples have, for the most part, used transactions by default. Most of our examples have used container-managed transactions. As the name suggests, the transaction lifecycle is controlled by the EJB container. Container-managed transactions use the Java Transaction API, or JTA. Container-managed transactions have a default start and end point, however it is possible to configure these as we shall see later in this chapter. Java SE applications, which run outside an EJB container and so do not have JTA available, must use resource-local transactions. Resource-local transactions use the EntityManager interface. The application uses EntityManager methods to explicitly start and end transactions. We saw an example of this in Chapter 6.

A transaction is a sequence of one or more steps that add, modify, or delete persistent data. Typically the data is persisted to a database. All steps must succeed in which case the transaction succeeds or is committed. If any one step...