+

Search Tips   |   Advanced Search

Java Persistence API (JPA) Architecture


Data persistence, the ability to maintain data between application executions, is vital to enterprise apps because the required access to relational databases. Applications that are developed for this environment must manage persistence themselves or make use of third-party solutions to handle database updates and retrievals with persistence. The Java Persistence API (JPA) provides a mechanism for managing persistence and object-relational mapping and functions for the EJB 3.0 specifications.

The JPA spec defines the object-relational mapping internally, rather than relying on vendor-specific mapping implementations. JPA is based on the Java model that applies to Java EE environments, but JPA can function within a Java SE environment for testing application functions.

JPA represents a simplification of the persistence model. The JPA spec explicitly defines the object-relational mapping, rather than relying on vendor-specific mapping implementations. JPA standardizes the important task of object-relational mapping by using annotations or XML to map objects into one or more tables of a database. To further simplify the persistence model:

JPA is designed to operate both inside and outside of a Java Enterprise Edition (Java EE) container. When you run JPA inside a container, the applications can use the container to manage the persistence context. If there is no container to manage JPA, the application must handle the persistence context management itself. Applications that are designed for container-managed persistence do not require as much code implementation to handle persistence, but these applications cannot be used outside of a container. Applications that manage their own persistence can function in a container environment or a Java SE environment.

Elements of a JPA Persistence Provider

Java EE containers that support the EJB 3.0 model must support a JPA implementation, also called a persistence provider. A JPA persistence provider uses the following elements to allow for easier persistence management in an EJB 3.0 environment:





 

Related concepts

Task overview: Storing and retrieving persistent data with the JPA

 

Related tasks

Task overview: Data Studio pureQuery