|» Java Persistence API FAQ|
Q: How does EJB 3.0 improve over EJB 2.1?
A: The goal of EJB 3.0 is to target ease of development, the main theme of the Java EE 5 platform release. EJB 3.0 is a major simplification over the APIs defined by the EJB 2.1 and earlier specifications. The simplified EJB 3.0 API allows developers to program EJB components as ordinary Java objects with ordinary Java business interfaces rather than as heavy weight components. Both component and client code are simplified, and the same tasks can be accomplished in a simpler way, with fewer lines of code. Because it is much simpler, EJB 3.0 is also much faster to learn to use than EJB 2.1.
Q: What are the benefits of using this simplified API?
A: All of the benefits of the EJB technology continue to be available to you--automatic management of transactions, security, scalability, concurrency, distribution, portable environment access, persistence, and so on. With EJB 3.0, all of these services are now easier to access and use.
Q: Do my earlier EJB (2.1, 2.0, 1.1) applications continue to work?
A: Absolutely. Any application written to one of these earlier versions of the EJB specification will continue to work unchanged under EJB 3.0. It is not necessary to modify your application, to recompile your application, or even to modify its deployment descriptor.
Q: Can use of the EJB 3.0 Simplified API be combined with use of the EJB 2.1 and earlier APIs?
A: Yes. Components written to different versions of the EJB specification can be combined in a single application. Further, components written to the new EJB 3.0 API can be clients of existing EJB 2.1 and earlier components, and components written to EJB 2.1 and earlier can be clients of new components written to the EJB 3.0 API.
Q: What about persistence? What did you do to fix entity beans?
A: We introduced the Java Persistence API to provide a light-weight POJO persistence API for object/relational mapping. The Java Persistence API incorporates support for many of the features that EJB developers have been asking for, including support for improved object modeling, inheritance, polymorphism, an expanded query language, and rich metadata for the specification of object/relational mapping.
Q: What is the relationship between the EJB 3.0 Simplified API and the Java Persistence API?
A: The Java Persistence API is now the preferred persistence API for use with EJB 3.0 applications.
Q: Is use of the Java Persistence API restricted to the EJB tier?
A: No. The Java Persistence API can be used both in Java SE applications, as well as outside of EJB in Java EE 5 applications.
Q: Which version of EJB should I use now?
A: If you are writing new applications, you should use EJB 3.0 because of all of the advantages it offers. If you are updating an existing application, you have the choice of using the earlier APIs, or upgrading to the new EJB 3.0 APIs for the components that you are updating or adding to your application.
Q: I hear that deployment descriptors are no longer needed. Won't I be able to use deployment descriptors in EJB 3.0?
A: EJB 3.0 continues to support the use of deployment descriptors. You may use Java language metadata annotations or deployment descriptors. You may also combine the use of deployment descriptors with Java language metadata annotations to override the values of annotations or to supplement the use of annotations.
Q: How do Java language annotations relate to deployment descriptors?
A: In general, almost everything you can do with EJB 3.0 Java language annotations, you can do by means of the deployment descriptor, and vice versa. Because there are no "application-level" annotations, however, it is necessary to use the deployment descriptor to specify application-level metadata such as default interceptors.
Q: Can I use Java language annotations with my EJB 2.1 applications?
A: Java language metadata is a feature introduced by J2SE 1.5. To use Java language annotations with EJB, you need to use Java EE 5 and EJB 3.0.
Q: How can I obtain an implementation of EJB 3.0 and Java EE 5?
A: Download the Java EE 5 SDK.
Q: Where can I get source code for EJB 3.0?
A: The open source GlassFish EJB 3.0 implementation is available.
Q: Where can I get more information about EJB 3.0 and Project GlassFish?
A: Here are some useful links:
Simple examples of how to write EJB 3.0 session beans/message-driven beans
Information on how to become involved in GlassFish project
You can also write to: email@example.com to discuss any implementation issues with developers on the EJB team.
Q: Where can I send feedback on the EJB 3.0 specification?
A: Feedback can be sent to firstname.lastname@example.org