Java Persistence API FAQ

»  EJB 3.0 Technology FAQ

Java Persistence API FAQ


Q: Why have you introduced the new Java Persistence API as part of the Java EE 5 platform?

A: We introduced the Java Persistence API to the Java platform for two reasons. First, this new API simplifies the development of Java EE and Java SE applications using data persistence. Second, we wanted to get the entire Java community behind a single, standard persistence API.

Q: What are the advantages of the Java Persistence API?

A: The Java Persistence API draws upon the best ideas from persistence technologies such as Hibernate, TopLink, and JDO. Customers now no longer face the choice between incompatible non-standard persistence models for object/relational mapping. In addition, the Java Persistence API is usable both within Java SE environments as well as within Java EE, allowing many more developers to take advantage of a standard persistence API.

Q: What are some of the main features of the Java Persistence API?

A: The Java Persistence API is a POJO persistence API for object/relational mapping. It 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. It supports a rich, SQL-like query language (which is a significant extension upon EJB QL) for both static and dynamic queries. It also supports the use of pluggable persistence providers.

Q: Why was the Java Persistence API developed as part of JSR-220 (EJB 3.0)?

A: The Java Persistence API originated as part of the work of the JSR 220 Expert Group to simplify EJB CMP entity beans. It soon became clear to the expert group, however, that a simplification of EJB CMP was not enough, and that what was needed was a POJO persistence framework in line with other O/R mapping technologies available in the industry. Once an Earlier Draft of the EJB 3.0 specification including the Java Persistence API was released, the JSR-220 Expert Group received many requests from the community that this work be made available beyond just the scope of EJB.

Q: Why didn't you split off the Java Persistence API work into a separate JSR?

A: We believed that leveraging the work in the context of JSR-220 would minimize risk and deliver a high quality result more quickly. Further, it was important that this API integrate smoothly and consistently with the rest of the simplifications to the EJB 3.0 APIs. It therefore seemed best to extend this ongoing project, and draw additional experts into the JSR-220 group as appropriate as the work expanded.

Q: Why didn't you adopt Hibernate or JDO as the persistence API?

A: We chose to combine the best ideas from many sources in the new persistence API and create a practical, easy to use API to meet the needs of a majority of Java EE and Java SE community members. The Java Persistence API is not based on any single existing persistence framework but incorporates--and improves upon--ideas contributed by many popular frameworks, including Hibernate, TopLink, JDO, and others.

Q: What if I want to use the Java Persistence API outside of the Java EE platform?

A: The specification, RI, and TCK insure that the Java Persistence API works with Java SE as well as with Java EE. Passing the TCK for the Java SE portion allows vendors to be compliant with the Java Persistence API without having a Java EE certification.

Q: What will happen to other data persistence APIs now that the Java Persistence API is available?

A: The Java Persistence API is now the standard API for persistence and object/relational mapping for the Java EE platform. Earlier APIs of course will not go away, but we expect that they will become less interesting once this new standard API is available.

Q: How will the Java Persistence API evolve now that JSR 220 has been completed?

A: We expect to spin off the Java Persistence API into its own new JSR for future evolution. This means subsequent versions of the Java Persistence API will not be tied to future EJB JSRs. We expect to continue to draw expertise from a diversity of sources, quite likely including many of the members of the JSR 220 Expert Group who helped define the Java Persistence API.

Q: Will the Java Persistence API become part of Java SE?

A: There are no current plans to include the Java Persistence API in Java SE. As the Java Persistence API evolves, however, it is likely that this issue will be considered by the Java SE expert group in a future Java SE release.

Q: Are changes needed to existing EJB CMP applications?

A: Existing EJB CMP applications continue to work unchanged, and EJB CMP technology will continue to be supported. There is no need to migrate existing applications to the Java Persistence API. Further, it is possible within the same application to combine continue usage of EJB CMP entity beans with new EJB components that make use of the Java Persistence API.

Q: How can I obtain an implementation of the Java Persistence API?

A: We expect many vendors to offer products that include implementations of the Java Persistence API that can be used with Java SE or Java EE. You can obtain the open source GlassFish project implementation of the Java Persistence API.

Q: Where can I get more information about the Java Persistence API and Project GlassFish?

A: Here are some useful links:

Home page for GlassFish implementation of Java Persistence API

Simple Java Persistence API example with details on how to configure and run it in Java EE and Java SE

The download page for standalone implementation of Java Persistence API in GlassFish

Q: How can I get involved in the GlassFish project for the Java Persistence API?

A: The following GlassFish page contains helpful information on how to become involved in GlassFish project.

You can also subscribe to persistence@glassfish.dev.java.net alias to discuss any implementation issues with developers on the persistence team.

Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve