Home - rafalkieras/jpa-kss GitHub Wiki
#General info
JPA stands for Java Persistence API and it is a standard for Java platform that describes the management of relational data.
There are three versions of JPA released:
- JPA 1.0 - 11 May 2006
- JPA 2.0 - 10 December 2009
- JPA 2.1 - 22 April 2013
Since the JPA is just a standard, it needs an implementation, the generally known are as follows:
Vocabulary
PersistenceUnit - 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.
PersistenceContext - set of entities such that for any persistent identity there is a unique entity instance. Within a persistence context, entities are managed. The EntityManager controls their lifecycle, and they can access datastore resources.
EntityManager - the EntityManager API is used to create and remove persistent entity instances, to find entities by their primary key, and to query over entities. Each instance is associated with a persistence context. EntityManager is not thread-safe.
EntityManagerFactory - the interface used to create EntityManager instances. Creation of EntityManagerFactory is costly so it is supposed to be in the application scope. EntityManagerFactory is thread-safe.