EntityManager
EntityManager provides the persistence context in which the entities exist. The persistence context also allows you to manage transactions. Using EntityManager APIs, you can perform query and write operations on entities. The entity manager can be web-container-managed (in which case an instance of EntityManager is injected by the container), or application-managed. In this chapter, we are going to look at application-managed entity managers. We will visit container-managed entity managers in Chapter 7, Creating JEE Applications with EJB, when we learn about EJBs. The persistence unit of the entity manager defines the database connectivity information and groups entities that become part of the persistence unit. It is defined ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access