Java Persistence API
||This article needs additional citations for verification. (June 2010)|
The Java Persistence API, sometimes referred to as JPA, is a Java programming language framework managing relational data in applications using Java Platform, Standard Edition and Java Platform, Enterprise Edition.
Persistence in this context covers three areas:
- the API itself, defined in the
- the Java Persistence Query Language (JPQL)
- object/relational metadata
The final release date of the JPA 1.0 specification was 11 May 2006 as part of JSR 220. The JPA 2.0 specification was released 10 Dec, 2009. The JPA 2.1 specification was released 22 April, 2013.
A persistence entity is a lightweight Java class whose state is typically persisted to a table in a relational database. Instances of such an entity correspond to individual rows in the table. Entities typically have relationships with other entities, and these relationships are expressed through object/relational metadata. Object/relational metadata can be specified directly in the entity class file by using annotations, or in a separate XML descriptor file distributed with the application.
The Java Persistence Query Language 
The Java Persistence Query Language (JPQL) makes queries against entities stored in a relational database. Queries resemble SQL queries in syntax, but operate against entity objects rather than directly with database tables.
Motivation for creating the Java Persistence API 
Prior to the introduction of EJB 3.0 specification, many enterprise Java developers used lightweight persistent objects, provided by either persistence frameworks (for example Hibernate) or data access objects instead of entity beans. This due to the fact that entity beans, in previous EJB specifications, called for too much complicated code and heavy resource footprint, and they could be used only in Java EE application servers because of interconnections and dependencies in the source code between beans and DAO objects or persistence framework. Thus, many of the features originally presented in third-party persistence frameworks were incorporated into the Java Persistence API, and, as of 2006, projects like Hibernate (version 3.2) and TopLink Essentials have become themselves implementations of the Java Persistence API specification.
Related Technologies 
Enterprise JavaBeans 
The EJB 3.0 specification (itself part of the Java EE 5 platform) included a definition of the Java Persistence API. However, end-users do not need an EJB container or a Java EE application server in order to run applications that use this persistence API. Future versions of the Java Persistence API will be defined in a separate JSR and specification rather than in the EJB JSR/specification.
The Java Persistence API replaces the persistence solution of EJB 2.0 CMP (Container Managed Persistence).
Java Data Objects API 
The Java Persistence API was developed in part to unify the Java Data Objects API, and the EJB 2.0 Container Managed Persistence (CMP) API. As of 2009[update] most products supporting each of those APIs support the Java Persistence API.
The Java Persistence API specifies persistence only for relational database management systems. That is, JPA focuses on object-relational mapping (ORM) (note that there are JPA providers who support other database models besides relational database, but this is outside the scope of what JPA was designed for). Refer to JPA 2 spec section 1 introduction for clarification of the role of JPA, which states very clearly "The technical objective of this work is to provide an object/relational mapping facility for the Java application developer using a Java domain model to manage a relational database."
Service Data Object API 
The designers of the Java Persistence API aimed to provide for relational persistence, with many of the key areas taken from object-relational mapping tools such as Hibernate and TopLink. Java Persistence API improved on and replaced EJB 2.0, evidenced by its inclusion in EJB 3.0. The Service Data Objects (SDO) API (JSR 235) has a very different objective to the Java Persistence API and is considered  complementary. The SDO API is designed for service-oriented architectures, multiple data formats rather than only relational data, and multiple programming languages. The Java Community Process manages the Java version of the SDO API; the C++ version of the SDO API is managed via OASIS.
Gavin King founded Hibernate. He represented JBoss on JSR 220, the JCP expert group charged with developing JPA. This led to ongoing controversy and speculation surrounding the relationship between JPA and Hibernate. Sun Microsystems has stated that ideas came from several frameworks, including Hibernate and JDO.
JPA 2.0 
Development of a new version of JPA, namely JPA 2.0 JSR 317 was started in July 2007. JPA 2.0 was approved as final on December 10, 2009.
The focus of JPA 2.0 was to address features that were present in some of the popular ORM vendors but couldn't gain consensus approval for JPA 1.0.
The main features included in this update are:
- Expanded object-relational mapping functionality
- support for collections of embedded objects, linked in the ORM with a many-to-one relationship
- multiple levels of embedded objects
- ordered lists
- combinations of access types
- A criteria query API
- standardization of clarify] [
- standardization of additional metadata to support DDL generation
- support for validation
Vendors supporting JPA 2.0
- DataNucleus (formerly JPOX)
- EclipseLink (formerly Oracle TopLink)
- JBoss with Hibernate
- IBM, via its OpenJPA-based Feature Pack for OSGi Applications and JPA 2.0 for WebSphere Application Server
- Versant JPA (not relational, object database)
See also 
- SAP NetWeaver Application Server
- .NET Persistence API (NPA)
- Hibernate EntityManager: Java SE environments
Hibernate EntityManager: Obtaining an EntityManager in a Java SE environment
- "JSR 220 Members".
- Barreto, Charlton. "SDO and JPA". Digital Walkabout. Retrieved 5 May 2011.
- Edwards, Mike. "SDO and Java Persistence Architecture (JPA)". Open SOA. osoa.org. Retrieved 5 May 2011.
- "hibernate.org - Java Persistence with Hibernate". JBoss. Retrieved 2008-11-17. "Hibernate implements the Java Persistence object/relational javaAPI and persistence management interfaces"
- "Manning: Java Persistence with Hibernate". Manning. "Gavin King -- the founder of the Hibernate project"
- "JBoss.com - Industry Leadership". JBoss. Retrieved 2008-11-17. "JSR 220, EJB 3.0 Spec Committee, Gavin King, Bill Burke, Marc Fleury"
- "Java Persistence API FAQ". Sun Microsystems. Archived from the original on 2008-08-22. Retrieved 2010-07-01. "The Java Persistence API draws upon the best ideas from persistence technologies such as Hibernate, TopLink, and JDO"
|Wikibooks has a book on the topic of: Java Persistence|
General info 
- JCP Persistence page
- GlassFish's Persistence page
- Documentation for the final version of the EJB3 spec (called JSR220)
- JPA Java Persistence API
- Java EE 6 Persistence API tutorial
- Java EE 6 Persistence API Javadoc
- Hibernate EntityManager User guide
- Hibernate Javadoc: org.hibernate.ejb
- EclipseLink JPA tutorials for Application Servers
- DataNucleus JPA tutorial for RDBMS
- Versant JPA Getting Started Tutorial