Converting an EJB 2.0 Entity
to an EJB 3.0 Entity
The Enterprise JavaBeans ( EJB ) 3.0 specification has facilitated the development of
EJBs by providing an annotations-based API in which the remote/local and home/
local home interfaces are not required. The deployment descriptors that form the
basis of an EJB 2.0 entity bean are also not required for deploying an EJB 3.0 entity
bean. In Chapter 1, we discussed the new features in EJB 3.0. This chapter covers the
procedure to convert an EJB 2.0 Entity to an EJB 3.0 Entity.
The EJB 3.0 entity bean classes are simplified in comparison to the EJB 2.0
specification classes. The EJB 3.0 entity class is a Plain Old Java Object ( POJO )
instead of a class implementing the EntityBean interface. The component interfaces
in EJB 2.0, which were required to extend the EJBLocalObject / EJBObject and
home interfaces, which were required to extend the EJBLocalHome / EJBHome
interfaces, are replaced with the javax.persistence.EntityManager API to create,
find, and update entity bean instances.
Setting the environment
We shall be creating an EJB 3.0 entity by transforming the EJB 2.0 deployment
descriptor ( ejb-jar.xml ) using XSL stylesheets. This chapter uses the built-in XSL
transformation tool in Oracle JDeveloper 11 g to provide the XSLT transformation
for converting the EJB 2.0 entity deployment descriptor to the EJB 3.0 entity class.
Download and install Oracle JDeveloper 11 g from http://www.oracle.com/