Skip Headers
Oracle® TopLink Developer's Guide
10g (10.1.3.1.0)
B28218-01
  Go To Documentation Library
Library
Go To Product List
Product
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next
 

Understanding the EJB 3.0 JPA Entity Architecture

A part of the EJB 3.0 specification, the Java Persistence API (JPA) is a lightweight, POJO-based framework for Java persistence. JPA focuses on object-relational mapping and contains a full object-relational mapping specification supporting the use of Java language metadata annotations and/or XML descriptors to define the mapping between Java objects and a relational database. Object-relational mapping with the JPA is completely metadata-driven. JPA supports a SQL-like query language for both static and dynamic queries. It also supports the use of pluggable persistence providers.

JPA includes the following concepts:

For more information, see the following:

Example Implementations

An example of the entity beans with bean-managed persistence implementation is a Model-View-Controller Model 2 architectural design pattern that runs in a Java EE container, with servlets and JSP that access session beans and EJB 3.0-compliant entities using the TopLink-based JPA persistence provider.

Advantages and Disadvantages

The use of TopLink JPA entities offers the following advantages:

  • POJO persistence–in JPA, persistent objects are POJOs.

  • Object-relational mapping is completely metadata-driven.

  • The persistence API exists as a separate layer form the persistent objects and does not intrude upon them.

  • Using the query framework you can query across entities and their relationships without having to use concrete foreign keys or database columns. Also, you can define queries statically in metadata or create them dynamically by passing query criteria on construction. Queries can return entities as results.

  • Entities are mobile–objects are able to move from one JVM to another and back, and at the same time be usable by the application.

  • You can configure persistence features through the use of Java SE 5 annotations, or XML, or a combination of both. You may also rely on defaults.

  • If your application is running inside a container, the container provides support and ease of use; you can configure the same application to run outside a container.