Java Persistence API
From Wikipedia, the free encyclopedia
The Java Persistence API, sometimes referred to as JPA, is a Java programming language framework that allows developers to manage relational data in Java Platform, Standard Edition and Java Platform, Enterprise Edition applications.
The Java Persistence API originated as part of the work of the JSR 220 Expert Group.
Persistence consists of three areas:
- the API, defined in the javax.persistence package
- the Java Persistence Query Language
- object/relational metadata
Contents |
[edit] Entities
A Persistence entity is a lightweight Java class that typically represents a table in a relational database. Entity instances 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.
[edit] The Java Persistence Query Language
The Java Persistence Query Language (JPQL) is used to make 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.
[edit] Relationship of Persistence and Enterprise JavaBeans
Persistence was defined as part of the EJB 3.0 specification, which is itself part of the Java EE 5 platform. You do not need an EJB container or a Java EE application server in order to run applications that use Persistence, however. Future versions of the Java Persistence API will be defined in a separate JSR and specification than the EJB JSR/specification.
[edit] Motivation for creating Persistence
Many enterprise Java developers have been using lightweight persistent objects provided by open-source frameworks like Hibernate instead of entity beans because entity beans and enterprise beans were considered too heavyweight and complicated, and they could only be used in Java EE application servers. Many of the features of the third-party persistence frameworks were incorporated into the Java Persistence API, and projects like Hibernate and TopLink are now implementations of Persistence.
[edit] See also
[edit] External links
- General info
- Documentation
- Implementations
- Articles