Java Reference
In-Depth Information
Setting the environment
We need to install Oracle Fusion Middleware 11 g ( http://www.oracle.com/
technology/software/products/middleware/index.html ), which includes
WebLogic Server 11 g and JDeveloper 11 g . Also install Oracle database 10 g XE
Edition ( http://www.oracle.com/technology/software/products/database/
xe/index.html ) including the sample schemas. In this chapter, we won't be using
the standalone WebLogic Server, but shall test the application in the WebLogic
server that is integrated in JDeveloper 11g. However, an EAR file may be created and
deployed to the standalone version using a build script, which is discussed in some
of the other chapters. If the application is deployed to the standalone version, a data
source is required to be configured in WebLogic Server with Oracle database, which
is also explained in some of the other chapters, such as Chapter 8 , EJB 3.0 Database
Persistence with Ajax in the UI .
Creating database tables
We shall be creating EJB 3.0 entity beans from database tables. Therefore, first we
need to create the database table Oracle database XE . Connect to the Oracle database
XE with the OE schema and create tables ARTICLE , SECTION , and EDITION using the
following SQL scripts:
CREATE TABLE EDITION (id VARCHAR(100) PRIMARY KEY NOT NULL,
journal VARCHAR(100), publisher VARCHAR(100), edition VARCHAR(100));
CREATE TABLE SECTION (id VARCHAR(100) PRIMARY KEY NOT NULL,
section VARCHAR(100));
CREATE TABLE ARTICLE (id VARCHAR(100) PRIMARY KEY NOT NULL,
title VARCHAR(100), author VARCHAR(100));
We shall be modifying two of these tables later when we map EJB 3.0 relationships
between entities. We shall add an EDITION_ID column to the SECTION table, because
the Edition entity has one-to-many mapping with the Section entity. And, we shall
add the SECTION_ID and EDITION_ID columns to the ARTICLE table, as Section and
Edition entities have one-to-many mappings with the Article entity.
Creating an EJB 3.0 application
In this section, we create an EJB 3.0 application in JDeveloper 11 g . Start JDeveloper
11 g and select the New Application link in the Application navigator. In the
Create Java EE Web Application window, specify an Application Name ,
EJB3RelationshipsJSF for example, select the Java EE Web Application template,
and click on Next .
 
Search WWH ::




Custom Search