JPA Basic Terminology to Understand JPA Architecture
An entity is a persistence domain object. Entity represents a table in a relational database, and each entity instance corresponds to a row in that table.
JPA uses Annotations or XML to map entities to a Relational database.
The persistent state of an entity fields or properties (setter and getter methods) use object/relational mapping annotations to map the entities and entity relationships to the relational data in the underlying data store.
EntityManager is an interface to perform main actual database interactions.
Creates persistence instance.
Removes persistence instance.
Finds entities by entity’s primary key.
Allows queries to be run on entities.
Persistence Context : A persistence context handles a set of entities which hold data to be persisted in some persistence store (e.g. database).
Each EntityManager instance is associated with a Persistence Context.
A persistence unit defines a set of all entity classes that are managed by EntityManager instances in an application.
This set of entity classes represents the data contained within a single data store.
Persistence units are defined by the persistence.xml configuration file.
JPA uses the persistence.xml file to create the connection and setup the required environment. Provides information which is necessary for making database connections.