Book Image

Java EE Development with Eclipse

By : Deepak Vohra
Book Image

Java EE Development with Eclipse

By: Deepak Vohra

Overview of this book

<p>Java EE is the industry standard on enterprise computing and Oracle WebLogic Server is the most comprehensive platform for enterprise applications. The book combines Java EE with WebLogic Server in the most commonly used Java IDE, the Eclipse IDE 3.7.<br /><br />"Java EE Development with Eclipse" is the only book on Eclipse IDE for Java EE Developers. The book is a practical guide for using the most commonly used Java EE technologies and frameworks in Eclipse IDE. Sample applications are available in downloadable format and may be customized to meet requirements. Oracle Enterprise Pack for Eclipse 12c, an enhancement to Eclipse IDE, providing additional project facets and an integrated support for Oracle WebLogic Server is used.<br /><br />"Java EE Development with Eclipse" is based on developing applications with some of the commonly used technologies using the project facets in Eclipse 3.7 and its enhancement Oracle Enterprise Pack for Eclipse 12c. <br /><br />The book starts with a discussion on EJB 3.0 database persistence with Oracle database XE and Oracle WebLogic Server. JAXB is discussed in the context of bi-directional mapping between XML and Java. A generic web project is developed for PDF and Excel spread sheet reports. JavaServer Faces, the most commonly used view component in web applications is discussed for developing a data table. Facelets, which was integrated into JSF with 2.0 version is discussed in the context of templating. ADF Faces components are used to develop another user interface (UI) application. Web services are discussed with JAX-WS and JAX-RS technologies. Java EE frameworks Ajax and Spring are also discussed.</p>
Table of Contents (17 chapters)
Java EE Development with Eclipse
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating tables in the Oracle database


We need to create database tables for database persistence. Create database tables CATALOG, EDITION, SECTION, and ARTICLE with the following SQL script; the script can be run from the SQL command line:

CREATE TABLE CATALOG (id INTEGER PRIMARY KEY NOT NULL, 
journal VARCHAR(100));
CREATE TABLE EDITION (id INTEGER PRIMARY KEY NOT NULL, 
edition VARCHAR(100));
CREATE TABLE SECTION (id VARCHAR(100) PRIMARY KEY NOT NULL, 
sectionName VARCHAR(100));
CREATE TABLE ARTICLE(id INTEGER PRIMARY KEY NOT NULL, 
title VARCHAR(100));

As Oracle database does not support the autoincrement of primary keys, we need to create sequences for autoincrementing, one for each table. Create sequences CATALOG_SEQ, EDITION_SEQ, SECTION_SEQ, and ARTICLE_SEQ with the following SQL script.

CREATE SEQUENCE CATALOG_SEQ MINVALUE 1 START WITH 1 INCREMENT BY 1 NOCACHE; 
CREATE SEQUENCE EDITION_SEQ MINVALUE 1 START WITH 1 INCREMENT BY 1 NOCACHE; 
CREATE SEQUENCE SECTION_SEQ MINVALUE 1 START WITH 1 INCREMENT BY 1 NOCACHE; 
CREATE SEQUENCE ARTICLE_SEQ MINVALUE 1 START WITH 1 INCREMENT BY 1 NOCACHE;

We also need to create join tables between tables. Create join tables using the following SQL script:

CREATE TABLE  CATALOGEDITIONS(catalogId INTEGER, editionId INTEGER);
CREATE TABLE EditionCatalog(editionId INTEGER, catalogId INTEGER);
CREATE TABLE EditionSections (editionId INTEGER, sectionId INTEGER);
CREATE TABLE SectionEdition (sectionId INTEGER, editionId INTEGER);
CREATE TABLE SectionArticles(sectionId INTEGER, articleId INTEGER);
CREATE TABLE ArticleSection(articleId INTEGER, sectionId INTEGER);