Jump to content

Jakarta Persistence: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
VOGELLA (talk | contribs)
VOGELLA (talk | contribs)
Line 37: Line 37:
** [https://java.sun.com/javaee/5/docs/api/javax/persistence/package-summary.html Java Persistence API Javadoc]
** [https://java.sun.com/javaee/5/docs/api/javax/persistence/package-summary.html Java Persistence API Javadoc]
** [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40ff8a3d-065a-2910-2f84-a222e03d1f43 Getting started with Java Persistence API 1.0]
** [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40ff8a3d-065a-2910-2f84-a222e03d1f43 Getting started with Java Persistence API 1.0]
** [http://www.vogella.de/articles/JavaPersistenceAPI/article.html Tutorial for using the JPA]
* Implementations
* Implementations
** [http://www.thoughtinc.com CocoBase] JPA Certified Commercial implementation for standalone and container services
** [http://www.thoughtinc.com CocoBase] JPA Certified Commercial implementation for standalone and container services

Revision as of 19:12, 13 April 2008

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

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.

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 .

Relationship between Java Persistence API and Enterprise JavaBeans

The Java Persistence API 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 rather than in the EJB JSR/specification.

Relationship between Java Persistence API and Service Data Object API

The Java Persistence API is designed for relational persistence, with many of the key areas taken from object-relational mapping tools such as Hibernate and TopLink. It is generally accepted that the Java Persistence API is a significant improvement on the EJB 2.0 specification. 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 version of the SDO API is managed via the JCP and the C++ version of the SDO API is managed via OASIS.

Motivation for creating Java Persistence API

Many enterprise Java developers have been using lightweight persistent objects provided by open-source frameworks or Data Access Objects 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 Open-Source Version TopLink Essentials are now implementations of the Java Persistence API.