- EJB 3.0 Database Persistence with Oracle Fusion Middleware 11g
- Deepak Vohra
- 606字
- 2021-04-13 17:23:09
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.
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 11g 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 11g from http://www.oracle.com/technology/software/products/middleware/index.html.
First, create a new application in JDeveloper. To do so, click on New Application, as shown next:

In the New Application wizard, specify an Application Name (for example EJB2toEJB3
). Select Application Template as Generic Application and click on Next, as shown in the following screenshot:

Next, specify a Project Name (EJB2toEJB3
for example). Select XML as a project technology and click on Finish.

An application and a project get added to the Application Navigator, as shown next:

Next, we create an XML document for the EJB 2.0 entity deployment descriptor, which is to be converted to anEJB 3.0 entity. We shall also create EJB 3.0 Session bean fa?ade classes from the deployment descriptor. Select File | New and in the New Gallery window select Categories:General | XML. From the Items: window, select XML Document and click on OK.

In the Create XML File window, specify a File Name (ejb-jar-modified.xml
). We shall be using a slightly modified ejb-jar.xml
, as the deployment descriptor does not contain all the required information to convert an EJB 2.0 entity to an EJB 3.0 entity. Click on OK.

We also need to create the XSL stylesheets to transform the EJB 2.0 entity deployment descriptor to EJB 3.0 entity class and fa?ade classes. In the New Gallery window, select Categories:General | XML and Items:XSL Style Sheet and click on OK.

In the Create XSL File window specify an XSL File Name (entity-bean.xsl
) and click on OK. The XSL version is set to XSL 2.0 by default.

The XSL stylesheet entity-bean.xsl
gets added to the EJB2toEJB3
project. The following illustration shows the stylesheet copied from a later listing in this chapter.

Similarly, add XSL stylesheets fa?ade.xsl
and fa?ade-bean.xsl
to generate EJB 3.0 fa?ade classes with.

To test that the EJB 3.0 entity classes generated using XSL transformation comply with the EJB 3.0 API, add libraries EJB 3.0, Java EE 1.5, and Java EE 1.5 API to the project in the Project Properties window. First, select Tools | Project Properties. Subsequently, add the required libraries with the Add Library button. These libraries are pre-configured in JDeveloper and only need to be selected and added. Click on OK.

- Learning SQL Server 2008 Reporting Services
- 剪映短視頻剪輯零基礎(chǔ)一本通
- eZ Publish 4: Enterprise Web Sites Step/by/Step
- Creo 6.0快速入門、進(jìn)階與精通(升級版)
- Inkscape 0.48 Illustrator's Cookbook
- Photoshop+Adobe Camera Raw+Lightroom(攝影后期照片潤飾實戰(zhàn))
- 中文版Photoshop CS6從新手到高手(超值版)
- Adobe創(chuàng)意大學(xué)InDesign CS5 產(chǎn)品專家認(rèn)證標(biāo)準(zhǔn)教材
- Premiere Pro短視頻剪輯零基礎(chǔ)一本通
- Building Websites with VB.NET and DotNetNuke 4
- CorelDRAW X6核心應(yīng)用案例教程(全彩慕課版)
- 零基礎(chǔ)攝影后期修圖 Photoshop照片處理輕松入門
- 中文版3ds Max 2022基礎(chǔ)教程
- 中文版AutoCAD 2022從入門到精通
- KNIME視覺化數(shù)據(jù)分析