© Mike Keith, Merrick Schincariol, Massimo Nardone 2018
Mike Keith, Merrick Schincariol and Massimo NardonePro JPA 2 in Java EE 8https://doi.org/10.1007/978-1-4842-3420-4_6

6. Entity Manager

Mike Keith1 , Merrick Schincariol2 and Massimo Nardone3
Ottawa, Ontario, Canada
RR 3, RR 3, Almonte, Ontario, Canada
Helsinki, Finland

Entities do not persist themselves when they are created. Nor do they remove themselves from the database when they are garbage-collected. It is the logic of the application that must manipulate entities to manage their persistent lifecycle. JPA provides the EntityManager interface for this purpose in order to let applications manage and search for entities in the relational database.

At first, this might seem like a limitation ...

Get Pro JPA 2 in Java EE 8: An In-Depth Guide to Java Persistence APIs now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.