Chapter 8. EntityManager
Prev | Part 2. Java Persistence API | Next

## Chapter 8. EntityManager

The diagram above presents an overview of the `EntityManager` interface. For a complete treatment of the `EntityManager` API, see the Javadoc documentation. Methods whose parameter signatures consist of an ellipsis (...) are overloaded to take multiple parameter types.

| Note
Kodo extends the standard `EntityManager` interface with the `kodo.persistence.KodoEntityManager` interface to provide additional functionality.

The `EntityManager` is the primary interface used by application developers to interact with the EJB persistence runtime. The methods of the `EntityManager` can be divided into the following functional categories:

- `Transaction` association

- Entity lifecycle management

- Entity identity management

- Cache management

- `Query` factory

- Closing

## 8.1. Transaction Association

    public EntityTransaction getTransaction ();

Every `EntityManager` has a one-to-one relation with an `EntityTransaction` instance. In fact, many vendors use a single class to implement both the `EntityManager` and `EntityTransaction` interfaces. If your application requires multiple concurrent transactions, you will use multiple `EntityManager`s.

You can retrieve the `EntityTransaction` associated with an `EntityManager` through the `getTransaction` method. Note that most EJB persistence implementations can integrate with an application server's managed transactions. If you take advantage of this feature, you will control transactions by declarative demarcation or through the Java Transaction API (JTA) rather than through the `EntityTransaction`.

Prev | Up | Next
7.4. Closing the EntityManagerFactory | Home | 8.2. Entity Lifecycle Management