Developing JPA applications

The Java™ Persistence API (JPA) defines the management of persistence and object/relational mapping within Java Enterprise Edition (Java EE) and Java Standard Edition (Java SE) environments.

The Java Persistence API (JPA) represents a simplification of the persistence programming model. JPA manages persistence and object/relational mapping within the Java EE specification for Enterprise Java Beans 3.0. The JPA specification defines the object/relational mapping within its own guidelines instead of relying on vendor-specific mapping implementations. These features make applications that use JPA easier to implement and manage.

JPA combines the best features from previous persistence mechanisms such as Java Database Connectivity (JDBC) APIs, Object Relational Mapping (ORM) frameworks, and Java Data Objects (JDO). Creating entities under JPA is as simple as creating serializable classes. JPA supports the large data sets, data consistency, concurrent use, and query capabilities of JDBC. Like object-relational software and object databases, JPA allows the use of advanced object-oriented concepts such as inheritance. JPA avoids vendor lock-in because it does not rely on a strict specification like JDO and EJB 2.x entities.

The JPA implementation does not mandate that you migrate existing applications. Existing EJB 2.x Container Manager Persistence applications continue to execute without changes. JPA may not be ideal for every application, however, for many applications it provides a better alternative to other persistence implementations.

With the JPA tools in the product, you can use wizards to create and automatically initialize mappings. You can create new database tables from existing entity classes (top-down mapping) or new entity beans from existing database tables (bottom-up mapping). You can also use the tools to create mappings between existing database tables and entity beans (meet-in-the-middle mapping), where names or other attributes differ. For flexibility in designing your data access application, you can choose from a range of mapping types. You can create mappings from several types of Java class, and you can specify entity inheritance with several options for database design.

JPA is covered under the JSR 220 EJB 3.0 specification: JSR 220: Enterprise JavaBeans™ 3.0

 

Overview

You can read the following topics before creating a JPA applications. They provide planning and technology overview information that may be useful if you are new to JPA applications or developing JPA applications in this development environment.

JPA architecture

The Java Persistence API represents a simplification of the persistence programming model.

 

Getting started

If you are already familiar with JPA applications technology the following topics will help you set up your workspace for JPA applications development, and guide you through the development process.

 

Samples and tutorials

The following JPA tutorial is included with this product:

Create and configure a JPA project

EJB 3.0 Online Library application

 

Resources for learning available on the Web

In addition to the information found in this infocenter, the following links provide additional learning material.

IBM® Redbooks®: WebSphere® Application Server Version 6.1 Feature Pack for EJB 3.0

Latest developerWorks articles and tutorials about JPA in Rational Application Developer

Latest developerWorks articles and tutorials about JPA