Architectural Overview
Standards Adherence
OpenJPA is an implementation of the JPA 1.0 Specification that is a subspecification under the SUN EJB 3.0 specification, developed under JSR 220. At the time of this writing, JPA 2.0 is being developed under its own JSR 317, and EJB 3.1 is being developed under JSR 318. The website is the definitive source for the JPA 2.0 specifications [JPA 2].
Platforms Required
Before Java EE 5.0 and EJB 3.0, the persistence layer of the Java EE platform required a full-blown Java EE Application Server. JPA changes this. OpenJPA applications can be written to run in both Java SE and Java EE environments. However, there are some differences in JPA applications hosted inside a Java EE environment as opposed to a Java SE environment. Rather than discuss the differences here, we will highlight them where they exist throughout the remainder of this chapter.
Other Dependencies
OpenJPA comes bundled with several other JARs needed to make it run. Like many Apache projects, it makes use of other Apache licensed packages:
- Several of the Apache Commons projects :commons-lang, commons-logging, commons-pool, and commons-collections. Please refer to the Apache Commons website for more information [Apache].
- Apache OpenJPA relies on the Serp project for Java "bytecode enhancement" to add persistence behavior to annotated Java files as a separate step. The Serp JAR comes bundled with OpenJPA. We discuss this step in the later section "Development Process for the Common Example." You can read more about Serp at their website [Serp].
- A valid JDBC database driver.
- For Java EE applications, any JARs required to run OpenJPA in a target Java EE Server.
Vendors and Licenses
OpenJPA is distributed under an Apache License. As mentioned in Chapter 2, an Apache License is more liberal in what you can do with the source because you can change parts of the code, and you don't need to distribute them back to the original authors. In addition, several commercial products ship an OpenJPA implementation, such as IBM WebSphere Application Server and BEA WebLogic Server.
It is worth noting that because JPA is a specification, there are other JPA implementations available beyond the OpenJPA version:
- Hibernate JPA. Refer to Chapter 7, "Hibernate Core," or the Hibernate website [Hibernate] for license information.
- TopLink Essentials, which is an open-source implementation that Oracle built on top of TopLink. We discussed TopLink briefly in Chapter 1. See their website for more information [TopLink].
Available Literature
OpenJPA is very well documented on their website. In addition, there are several articles available. Table 8.1 shows some examples.
Table 8.1. OpenJPA Resources
Resource |
Link |
Description |
OpenJPA Manuals [OpenJPA 2] |
Comprehensive OpenJPA Module |
|
Integrating OpenJPA with Application Servers [OpenJPA 3] |
List of other articles for integrating OpenJPA with other Application Server. |
|
Building EJB 3 Applications with WebSphere Application Server |
www.ibm.com/developerworks/websphere/techjournal/0712_barcia/0712_barcia.html |
Tutorial on using OpenJPA inside the WebSphere EJB 3 Container |
Leveraging OpenJPA with WebSphere Application Server A.8.1
|
www-128.ibm.com/developerworks/websphere/techjournal/0612_barcia/0612_barcia.html |
Tutorial on using OpenJPA inside WebSphere Application Server |
Java Persistence with Hibernate [Bauer] A.8.2
|
Book on using Hibernate JPA API |
|
Enterprise JavaBeans, 5th Edition [Monson-Haefel] |
Comprehensive sourcebook on EJB 3 |
|
Migrating Legacy Hibernate Applications to OpenJPA and EJB 3 A.8.3
|
www.ibm.com/developerworks/websphere/techjournal/0708_vines/0708_vines.html |
Techniques useful to migrate a Hibernate Core Application to OpenJPA |
Besides OpenJPA, there are many other resources available on the JPA programming model.