OracleAS 10g R3: Build J2EE Applications II

Similar documents
E Oracle 10g Java Bootcamp II v1

Oracle Application Server 10g R3: Administration

Oracle 11g: XML Fundamentals

Oracle SOA Suite 10g R3: Administration. Student Guide

Business Component Development with EJB Technology, Java EE 5

Oracle Application Server 10g R2: Administration II

E Oracle 10g Java Bootcamp I v1

Java Programming Language

Oracle Adaptive Access Manager: Administration Student Guide

OracleAS 10g R3: Build Web Services

OracleAS 10g R3: Java Programming

Oracle Forms Developer 10g: Move to the Web

Oracle 10g: Java Programming

Chapter 1 Introducing EJB 1. What is Java EE Introduction to EJB...5 Need of EJB...6 Types of Enterprise Beans...7

Oracle Database 10g: PL/SQL Fundamentals

Oracle WebLogic Server 11g: Overview for WLS Administrators

CO Java EE 7: Back-End Server Application Development

Java EE 7: Back-End Server Application Development

MySQL Performance Tuning

Oracle 10g: Build J2EE Applications

Oracle Communication and Mobility Server: Introduction Student Guide

Oracle Database 10g: PL/SQL Fundamentals

Oracle WebLogic Server 12c: JMS Administration Student Guide

J2EE - Version: 25. Developing Enterprise Applications with J2EE Enterprise Technologies

Oracle Service Bus 10g R3: Design & Integrate Services for SOA

Oracle Hyperion Data Relationship Management Administration Activity Guide

Java EE 6: Develop Business Components with JMS & EJBs

Oracle Database 10g: Using OLAP

Fast Track to EJB 3.0 and the JPA Using JBoss

Oracle Warehouse Builder 10g: New Features

Java- EE Web Application Development with Enterprise JavaBeans and Web Services

Oracle Database 11g: Use XML DB

Oracle Data Integrator 11g: Integration and Administration Student Guide - Volume I

Oracle BI Publisher 10g R3: Fundamentals

Sun Java System Application Server 8.1: Administration & Deployment

Oracle Warehouse Builder 10g: Administration

Oracle Data Integrator 11g: Advanced Integration and Development Student Guide

Java EE Patterns. Student Guide - Volume 1. SL-500 Rev C.0.1. D61856GC10 Edition 1.0 D62465

Oracle Data Integrator: Administration and Development Volume I Student Guide

Oracle Warehouse Builder 10g: Implementation Part 2

Deccansoft Software Services. J2EE Syllabus

Oracle Database 10g: Data Guard Administration

Oracle Database 10g: New Features for Release 2 Overview Seminar

Oracle WebLogic Server 12c: Administration I

Oracle VM Administration: Oracle VM Server for x86 Student Guide

Oracle Application Testing Suite: Introduction Student Guide

Implementing a Web Service p. 110 Implementing a Web Service Client p. 114 Summary p. 117 Introduction to Entity Beans p. 119 Persistence Concepts p.

Siebel 8.1.x Fundamentals Student Guide

Oracle Service Bus 10g R3: System Administration

Oracle GoldenGate 11g: Advanced Configuration for Oracle Student Guide

Oracle Database 10g: SQL Fundamentals I

Oracle Application Express: Administration Student Guide

Web Application Development Using JEE, Enterprise JavaBeans and JPA

Using Java - for PL/SQL and Database Developers Student Guide

Oracle VM Server for x86: Administration

MySQL Cluster Student Guide

Oracle 10g: XML Fundamentals

Oracle BI Publisher 11g R1: Fundamentals

Enterprise JavaBeans 3.1

Oracle Fusion Middleware

Web Application Development Using JEE, Enterprise JavaBeans and JPA

Oracle WebCenter Sites 11g for Developers

Oracle BI 11g R1: Build Repositories

Oracle Database 10g: Implementing Database Vault

SCBCD EXAM STUDY KIT. Paul Sanghera CX JAVA BUSINESS COMPONENT DEVELOPER CERTIFICATION FOR EJB MANNING. Covers all you need to pass

UNIX and Linux Essentials Student Guide

Oracle WebCenter Content 11g: Content Server Customization Student Guide - Volume I

Java EE Application Assembly & Deployment Packaging Applications, Java EE modules. Model View Controller (MVC)2 Architecture & Packaging EJB Module

Oracle GoldenGate 11g: Fundamentals for SQL Server Student Guide

V3 EJB Test One Pager

Oracle TimesTen 6.0: Core Concepts and Administration Volume I - Student Guide

Enterprise JavaBeans, Version 3 (EJB3) Programming

OracleAS Portal 10g: Build Portlets with Java

Oracle Database 11g: SQL Fundamentals I

JVA-163. Enterprise JavaBeans

Oracle - Developing Applications for the Java EE 7 Platform Ed 1 (Training On Demand)

Oracle Identity Manager 11g: Essentials

NetBeans IDE Field Guide

Oracle BPM 10g R3 Programming 1 Essentials

Siebel Application Deployment Manager Guide. Version 8.0, Rev. A April 2007

Oracle Database 11g: Oracle Secure Backup

index_ qxd 7/18/02 11:48 AM Page 259 Index

Oracle Fusion Middleware

Oracle9i: XML Fundamentals for Developers

Oracle GoldenGate 11g Fundamentals for Oracle

Oracle Database 10g: Implement and Administer a Data Warehouse

Oracle Content Server 11g: Administration

Oracle Database 12c: Install and Upgrade Workshop

Oracle TimesTen 6.0: Core Concepts and Administration Volume I Student Guide

Sun Virtualization: Solaris 10 Containers Administration

Oracle TimesTen 7.0: IMDB, Cache Connect, and Replication Volume I Student Guide

Architect Exam Guide. OCM EE 6 Enterprise. (Exams IZO-807,1ZO-865 & IZO-866) Oracle Press ORACLG. Paul R* Allen and Joseph J.

J2EE Development. Course Detail: Audience. Duration. Course Abstract. Course Objectives. Course Topics. Class Format.

Oracle WebLogic Server 11g: Diagnostics and Troubleshooting

J2EE Interview Questions

Analytics: Server Architect (Siebel 7.7)

Exam Actual. Higher Quality. Better Service! QUESTION & ANSWER

Overview p. 1 Server-side Component Architectures p. 3 The Need for a Server-Side Component Architecture p. 4 Server-Side Component Architecture

Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1

Oracle Database 11g: Backup and Recovery Workshop

Transcription:

OracleAS 10g R3: Build J2EE Applications II Volume I Student Guide D18380GC10 Edition 1.0 April 2006 D45763

Authors David Loo Glenn Stokol Technical Contributors and Reviewers Michael Burke Dr. Ken Cooper Gary Crutchfield Craig Hollister Taj-ul Islam Peter Laseau Mike Lehmann Debu Panda Nagavalli Pataballa Gayathri Rajagopal Guus Ramackers Holger Dindler Rasmussen Venkat Tallapragada Jon Wetherbee Ted Witiuk Dr. Volker Zell Frances Zhao Copyright 2006, Oracle. All rights reserved. Disclaimer This document contains proprietary information and is protected by copyright and other intellectual property laws. You may copy and print this document solely for your own use in an Oracle training course. The document may not be modified or altered in any way. Except where your use constitutes "fair use" under copyright law, you may not use, share, download, upload, copy, print, display, perform, reproduce, publish, license, post, transmit, or distribute this document in whole or in part without the express authorization of Oracle. The information contained in this document is subject to change without notice. If you find any problems in the document, please report them in writing to: Oracle University, 500 Oracle Parkway, Redwood Shores, California 94065 USA. This document is not warranted to be error-free. Restricted Rights Notice If this documentation is delivered to the United States Government or anyone using the documentation on behalf of the United States Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS The U.S. Government s rights to use, modify, reproduce, release, perform, display, or disclose these training materials are restricted by the terms of the applicable Oracle license agreement and/or the applicable U.S. Government contract. Trademark Notice Oracle, JD Edwards, PeopleSoft, and Siebel are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Editors Arijit Ghosh Richard Wallis Graphic Designer Steve Elwood Publisher Joseph Fernandez

Contents Preface 1 OracleAS 10g Release 3: Build J2EE Applications II Objectives 1-2 Agenda 1-3 Course Objectives 1-4 Course Agenda 1-6 Review of J2EE Architecture 1-9 J2EE Platform and APIs 1-10 Overview of J2EE Web Application Architecture 1-15 Overview of J2EE Enterprise JavaBeans Application Architecture 1-16 Overview of Web Services for J2EE and APIs 1-18 Course Environment 1-19 Course Application Scenario: Connections and Database Schema 1-20 Creating a Database Connection in JDeveloper 1-21 Creating an Application Server Connection in JDeveloper 1-22 Summary 1-23 Practice 1 Overview: Exploring the Course Application Environment 1-24 2 Designing J2EE Applications Objectives 2-2 Course Application Scenario: Deploy and Explore the Application 2-3 Building J2EE User Interfaces 2-4 Designing a J2EE Application 2-5 Defining the MVC Architecture 2-6 Implementing Model 1 or Model 2 Designs 2-7 Implementing the User Interface with JSF and Core J2EE Patterns 2-8 Implementing a Session Facade Pattern 2-9 Working with Enterprise JavaBean Types 2-10 Developing EJB 3.0 Components 2-11 Introduction to EJB Metadata Annotations 2-12 Selecting a Persistence Strategy 2-13 Messaging with JMS and Message-Driven Beans 2-14 Managing Applications with Java Management Extensions (JMX) 2-15 Integrating Applications with Java Connector Architecture (JCA) 2-16 Securing Applications with Java Authentication and Authorization Service 2-17 Course Application Components 2-18 SRDemo User Interface 2-19 Summary 2-20 Practice 2 Overview: Exploring the Course Application Design 2-21 iii

3 Configuring Data Sources Objectives 3-2 Course Application Scenario: Create and Test a Data Source 3-3 What Is a Data Source? 3-4 Choosing a JDBC Driver 3-6 Selecting the Type of Data Source 3-8 Support for Oracle JDBC in Data Sources 3-9 Creating a Data Source in Application Server Control 3-10 Creating a Managed Data Source in Application Server Control 3-11 Configuring a Connection Pool 3-12 Creating a Connection Pool with Application Server Control 3-13 Setting the Connection Pool Properties 3-14 Setting Connection Pool Attributes 3-15 Configuring a Managed Data Source 3-16 Configuring a Native Data Source 3-17 Testing the Data Source Configuration in Oracle Application Server 10g 3-18 Packaging Application-Specific Data Sources 3-20 Using Data Sources in Java 3-21 Working with Data Sources Prior to Oracle Application Server 10g R3 3-22 Automigration of Data Sources 3-23 Configuring Data Sources for Non-Oracle Databases 3-24 Summary 3-25 Practice 3 Overview: Configuring Data Sources 3-26 4 Creating EJB Entities Objectives 4-2 Course Application Scenario: Create Business-Tier Persistence Components 4-3 What Are EJB Entities? 4-4 Managing Persistence of EJB Entities 4-5 Declaring an EJB 3.0 Entity 4-6 Specifying Object Relational (O-R) Mapping with Annotations 4-7 Generating Primary Key Values 4-8 Mapping Relationships Between Entities 4-9 Implementing One-to-One Relationships 4-11 Implementing Many-to-One Relationships 4-12 Implementing One-to-Many Relationships 4-13 Implementing Many-to-Many Relationships 4-14 Summary 4-15 Practice 4 Overview: Creating EJB 3.0 Entities and Relationships 4-16 iv

5 Creating Session Beans Objectives 5-2 Course Application Scenario: Create a Session Facade and a Test Client 5-3 What Is a Session Bean? 5-4 Stateless Versus Stateful Session Beans 5-5 Life Cycle of a Stateless Session Bean 5-6 Creating a Stateless Session Bean 5-7 Define the Stateless Session Bean 5-8 Create the Remote and Local Interfaces 5-9 Create a Test Client for the SLSB 5-10 Life Cycle of a Stateful Session Bean 5-11 Passivation and Activation Concepts 5-13 Creating a Stateful Session Bean 5-14 Define the Stateful Session Bean 5-15 Create the Remote and Local Interfaces 5-16 Create a Test Client for the SFSB 5-17 Interceptor Methods and Classes 5-18 Interceptor Method 5-19 Interceptor Classes 5-20 Summary 5-21 Practice 5 Overview: Creating Session Beans 5-22 6 Accessing Resources with JNDI and Dependency Injection Objectives 6-2 Course Application Scenario: Create a Service Locator for JNDI operations 6-3 Java Naming and Directory Interface 6-4 Referencing J2EE Resources with JNDI 6-5 Providing JNDI Properties 6-6 Referencing a Local Session EJB with JNDI 6-8 Referencing a Remote Session EJB with JNDI 6-9 Dependency Injection 6-10 Types of Dependency Injection 6-11 Defining the @Resource Annotation 6-12 Using J2EE Resources with Dependency Injection 6-13 Working with Dependency Injection 6-14 Referencing EJBs with Dependency Injection 6-15 Working with JNDI Enhancements in OC4J 6-16 Enabling Global JNDI Lookup 6-18 v

Relaxing JNDI Lookup Constraints 6-19 Summary 6-20 Practice 6 Overview: Locating EJBs and Resources 6-21 7 Manipulating and Querying with the EntityManager API Objectives 7-2 Course Application Scenario: Query Service Requests for JSF Pages 7-3 What Is EntityManager? 7-4 Managing an Entity Life Cycle with EntityManager 7-5 Creating an EntityManager Instance 7-7 Specifying Database Operations with the EntityManager API 7-8 Inserting Data 7-9 Updating Data 7-10 Deleting Data 7-11 Finding an Entity by Primary Key 7-12 Retrieving Entities by Using the Query API 7-13 Writing a Basic EJB QL Statement 7-14 Creating Named Queries 7-15 Writing Dynamic Queries 7-16 Summary 7-17 Practice 7 Overview: Using the EntityManager and Query APIs 7-18 8 Writing EJB Query Language Statements Objectives 8-2 Course Application Scenario: Manage Notifications and Triage Service Requests 8-3 Enterprise JavaBeans Query Language 8-4 Writing Basic EJB QL Statements 8-5 Writing the EJB QL SELECT Clause 8-6 Writing the FROM Clause 8-7 Adding Conditions to an EJB QL Query 8-8 Using Multivalued Expressions and Operators 8-9 Using EJB QL Functions 8-10 Executing Dynamic EJB QL with the Query API 8-11 Writing EJB QL in NamedQuery Annotations 8-12 Batching UPDATE and DELETE in EJB QL 8-14 Summary 8-15 Practice 8 Overview: Create NamedQuery and Dynamic Queries 8-16 9 Communicating with Message-Driven Beans Objectives 9-2 Course Application Scenario: Enable Email Notifications with an MDB 9-3 Messaging Systems 9-4 vi

Two Domains for JMS 9-5 Java Message Service 9-6 JMS Application Architecture 9-7 JMS Connector Architecture in OC4J 10g 9-8 Using Java Message Service Interfaces 9-9 Configuring Java Message Service 9-10 JMS Configuration File (jms.xml) 9-11 Message-Driven Beans 9-12 Life Cycle of a Message-Driven Bean 9-13 Creating a Message-Driven Bean 9-14 Creating a JMS/MDB Client 9-15 Summary 9-17 Practice 9 Overview: Creating a Message-Driven Bean 9-18 10 Managing Transactions with Session and Message-Driven Beans Objectives 10-2 Course Application Scenario: Manage Products with CMP or BMP Transactions 10-3 What Is a Transaction? 10-4 EJB Transaction Model 10-5 Managing Transactions with EJBs 10-6 Enterprise JavaBeans Support for Transactions 10-7 Types of Transaction Management 10-8 Container-Managed Transactions 10-9 Transaction Attribute: REQUIRED 10-10 Transaction Attribute: SUPPORTS 10-11 Transaction Attribute: MANDATORY 10-12 Transaction Attribute: NEVER 10-13 Transaction Attribute: REQUIRES_NEW 10-14 Transaction Attribute: NOT_SUPPORTED 10-15 CMT: setrollbackonly() 10-16 Container-Managed Transaction: Example 10-17 Java Transaction API (JTA) 10-18 JTA: UserTransaction Interface 10-19 Bean-Managed Transactions 10-20 Bean-Managed Transaction: Example 10-21 BMT Demarcation: Restrictions 10-22 Local and Global Transactions 10-23 Single-Phase Commit 10-24 Enlisting Database Resources 10-25 vii

Configuring the Transaction Manager in OC4J 10-26 Summary 10-27 Practice 10 Overview: Managing Transactions 10-28 11 Scheduling Tasks and Jobs for J2EE Applications Objectives 11-2 Course Application Scenario: Escalate E-mail Messages for Unassigned Service Requests 11-3 Why Use EJB Timers? 11-4 EJB Timers 11-5 Limitations of EJB Timers 11-6 EJB TimerService Interface 11-7 EJB Timer and TimerHandle Interfaces 11-8 Timer Example: Stateless Session Bean 11-9 Working with the OC4J EJBTimerService Interface 11-10 OC4J EJBTimerService Interface 11-11 Oracle Application Server Job Scheduler 11-12 Summary 11-13 Practice 11 Overview: Creating EJB Timers 11-14 12 Securing J2EE Applications with JAAS Objectives 12-2 Course Application Scenario: Add Web and EJB Security 12-3 Goals of J2EE Security Architecture 12-4 Overview of J2EE Security Architecture 12-5 Java Authentication and Authorization Service (JAAS) 12-6 Authorization of a Client 12-9 JAAS Provider Types in OC4J 12-10 XML-Based Provider Type 12-11 Configuring Security 12-12 Defining Users and Roles 12-13 Defining the Logical Roles 12-15 Defining and Using Logical Roles in Web Applications (web.xml) 12-16 Defining and Using Logical Roles in EJBs (ejb-jar.xml) 12-17 Mapping Logical Roles to Users and Groups 12-18 Programmatic Access to a Caller s Security Context 12-19 Client Authentication 12-20 EJB Client Authentication with the jndi.properties file 12-21 EJB Client Authentication with a Hashtable 12-22 Setting Access Control with JDeveloper 12-23 Creating Web Application Security Roles 12-24 Web Application Login Authentication 12-25 viii

Web Application Authorization 12-26 EJB Security Roles 12-27 Security Annotation: Example 12-28 Summary 12-29 Practice 12 Overview: Implementing Security 12-30 13 Deploying J2EE Applications Objectives 13-2 Course Application Scenario: Deploy to Oracle Application Server 10g 13-3 Deploying J2EE Applications 13-4 Planning Deployment 13-6 Packaging Business-Tier Components 13-8 Creating Web Application Archives 13-9 Creating EJB Archives 13-10 Creating Application Archives 13-11 Working with Deployment Descriptors 13-12 JSR-88 Deployment Plans 13-13 Creating a JSR-88 Deployment Plan 13-14 Working with JSR-88 Deployment Plans 13-15 Deploying with the Oracle Application Server 10g Control Console 13-16 Deploying with JSR-88 Ant Tasks 13-17 Deploying with admin_client.jar 13-18 Deploying with Oracle JDeveloper 13-19 Managing Shared Application Libraries 13-20 Summary 13-21 Practice 13 Overview: Deploying the SRDemo Course Application 13-22 Appendix A: Practices Appendix B: Practice Solutions Index ix