Skip Headers
Oracle® Application Server Containers for J2EE Enterprise JavaBeans Developer's Guide
10g Release 2 (10.1.2)
Part No. B15505-02
  Go To Documentation Library
Go To Product List
Solution Area
Go To Index



Title and Copyright Information

Send Us Your Comments


Who Should Read This Guide?
Documentation Accessibility
Prerequisite Reading
Suggested Reading
How This Guide Is Organized

1 How Do Applications Use EJBs?

New Features of EJB 2.0
Local Interface Support
Remote Access
Local Access
Local Interfaces and Container-Managed Relationships
Local Compared to Remote Access
Home Interface Business Methods
Message-Driven Beans
Enterprise JavaBeans Query Language (EJB QL)
CMP Relationships
Oracle Application Server Object-Relational Mapping
Third Party O-R Mappings - TopLink Integration
CORBA Support - RMI-over-IIOP
Changes in Defaults for Oracle Application Server
Which Type of EJB Should You Use in Your Application?
What is a Session Bean?
Retrieving the Context Using setSessionContext
What is a Stateless Session Bean?
What is a Stateful Session Bean?
What is an Entity Bean?
Entity Beans are Uniquely Identified by a Primary Key
Managing the Persistent Data Within the Entity Bean
Manage Your Persistent Data With Container-Managed Persistence
What is the Difference Between Session and Entity Beans?
When Do You Use a Message-Driven Bean?
What Makes Up An EJB?
Interfaces for Bean Implementation is Based on Bean Type
Parameter Passing Conventions for Your EJBs
How to Handle Returned Parameter Objects
What Container Services Can You Use for EJBs?

2 How to Access EJBs

Steps for Accessing Any EJB
Client Installation of OC4J.JAR
Setting JNDI Properties
No JNDI Properties
JNDI Properties File
JNDI Properties Within The Implementation
JNDI Properties for OC4J Standalone
When Do You Use the Different Initial Context Factory Classes?
An Initial Context Factory Specific to DNS Load Balancing
How to Lookup the EJB Reference
Configuring the EJB Reference Information
Example of How a Client Invokes an EJB
Accessing an EJB in a Remote Server
Accessing an EJB in Another Application
JAAS Support for EJBs
Using the RIMInitialContextFactory Object
Recovering From Deadlock Conditions
Recovering From a NamingException While Accessing a Remote EJB
Recovering From NullPointerException While Accessing a Remote EJB

3 Implementing Session Beans

Developing Session Beans
Implement the Session Bean
Creating the Home Interfaces
Creating the Component Interfaces
Implementing the Bean
Create the Deployment Descriptor
Archive the EJB Application
Prepare the EJB Application for Assembly
Modify the Application.XML File
Create the EAR File
Deploy the Enterprise Application to OC4J
When Does Stateful Session Bean Passivation Occur?
Object Types Enabled for Passivation
Storage of Passivated EJBs

4 CMP Entity Beans

Persistence Fields
Default Mapping of Persistent Fields to the Database
Explicit Mapping of Persistent Fields to the Database
Configuring Lazy Loading on CMP Entity Bean Finder Methods
Conversion of CMP Types to Database Types
Simple Data Types
Serializable Classes
Other Entity Beans or Collections

5 Entity Beans

Entity Bean Overview
Creating Entity Beans
Implement the Entity Bean Home Interface
Implement the Entity Bean Component Interfaces
Implement the Entity Bean Class
How to Define and Use Primary Keys for Your Entity Bean
Defining the Entity Bean Primary Key in a Class
Defining an Auto-Generated Primary Key for Your Entity Bean
Create Data Consistency in Your Entity Bean by Using Persistence
Tie Entity Beans Together Through Container-Managed Relationships
Managing the Entity Bean Lifecycle
Configuring Pool Sizes For Entity Beans
How to Avoid Database Resource Contention
Using Database Isolation Modes to Protect Against Resource Contention
Configuring Entity Bean Concurrency Modes For Handling Resource Contention
Specifying Exclusive Write Access to the Database
Effects of the Combination of the Database Isolation and Bean Concurrency Modes
Differences Between Pessimistic and Optimistic/Serializable
Affects of Concurrency Modes on Clustering
Using Transactions With Entity Beans
Providing Security for Your Entity Beans

6 Entity Relationship Mapping

Transaction Requirements
Defining Entity-To-Entity Relationships
Choosing Cardinality and Direction
One-To-One Relationship Overview
One-To-Many or Many-To-One Relationship Overview
Many-To-Many Relationship Overview
Requirements in Defining Relationships
Define the Get/Set Methods for Each Relationship Field
Set the Relationships in the Bean Implementation
Declare the Relationships in the Deployment Descriptor
Decide Whether to Use the Cascade Delete Option
Mapping Object Relationship Fields to the Database
Default Mapping of Relationship Fields to the Database
Example of a Default Mapping of the One-To-One Relationship
Example of a Default Mapping of One-To-Many and Many-To-Many Relationships
Explicit Mapping of Relationship Fields to the Database
Quick Cookbook for Matching an Existing Database to the Bean Mappings
Steps for Modifying CMR Mapping Elements
Hand-Editing orion-ejb-jar.xml to Map Bean Relationships to Database Tables
One-To-One Relationship Explicit Mapping
Table Mapping For Primary Keys That Use AutoId
Using a Foreign Key with the One-To-Many Relationship
Association Table Explicit Mapping for Relationships Overview
XML Structure for One-to-Many Relationship Mapping
Using an Association Table with a One-to-Many Bidirectional Relationship
Using an Association Table in a One-to-Many Unidirectional Relationship
Using an Association Table in Many-to-Many Relationships
Using a Foreign Key in a Composite Primary Key
How to Override a Foreign Key Database Constraint
Performing Inner or Outer Joins on One-to-One Relationships
Batching SQL statements in your entity beans�
How to map a CMP field and a CMR field to the same row in the database�
Synchronizing Data during Bean Creation�

7 EJB Query Language

EJB QL Overview
Query Methods Overview
Finder Methods
Select Methods
Return Objects
Deployment Descriptor Semantics
Finder Method Example
Specifying Finder Methods With EJB QL Syntax
Define the Finder Method in the Home Interface
Define the Finder Method Definition in the Deployment Descriptor
Relationship Finder Example
Specifying Finder Methods With OC4J-Specific Syntax
Add the Finder Method to Home Interface
Add the Query to the OC4J-Specific Deployment Descriptor
Select Method Example
Define the Select Method in the Bean Class
Define the Select Method Definition in the Deployment Descriptor
Oracle EJB QL Type Extensions: Date, Time, Timestamp, and SQRT

8 BMP Entity Beans

Creating BMP Entity Beans
Component and Home Interfaces
BMP Entity Bean Implementation
The ejbCreate Implementation
The ejbFindByPrimaryKey Implementation
Other Finder Methods
The ejbStore Implementation
The ejbLoad Implementation
The ejbPassivate Implementation
The ejbActivate Implementation
The ejbRemove Implementation
Modify XML Deployment Descriptors
Create Database Table and Columns for Entity Data

9 Message-Driven Beans

MDB Overview
MDB Example
MDB Implementation Example
EJB Deployment Descriptor (ejb-jar.xml) for the MDB
MDB Using OracleAS JMS
Configure OracleAS JMS in the XML files
JMS Destination Object Configuration
Create the OC4J-Specific Deployment Descriptor to Use OracleAS JMS
Specify the Destination and Connection Factory
Map Any Resource References to JNDI Names
Deploying the MDB
MDB Using Oracle JMS
Install and Configure the JMS Provider
Create User and Assign Privileges
Create JMS Destination Objects
Configure the OC4J XML Files for the JMS Provider
Configure the DataSource
Identify the JNDI Name of the Oracle JMS Data Source
Create the OC4J-Specific Deployment Descriptor to Use Oracle JMS
Specify the Destination and Connection Factory
Map Any Resource References to JNDI Names
Deploy the MDB
Client Access of MDB
Using an Explicit Name for the JNDI Lookup
Accessing OracleAS JMS Destination with Explicit JNDI Names
Accessing Oracle JMS Destination with Explicit JNDI Names
Steps for Sending a Message to an MDB
Using a Logical Name When Client Accesses the MDB
JNDI Naming for OracleAS JMS
JNDI Naming for Oracle JMS
Client Sends JMS Message Using Logical Names
Windows Considerations When Using MDBs
Failover Scenarios When Using a RAC Database

10 Understanding Environment, Deployment, and Packaging

Directory Structure Recommendations for EJB Development
Create the Deployment Descriptor
Archive the EJB Application
Prepare the EJB Application for Assembly
Modify the Application.XML File
Create the EAR File
Deploy the Enterprise Application to OC4J
Out Of Memory Error During Deployment
Sharing Classes
Out of Memory During Execution
Static Block in an EJB
OC4J Instances Terminating Due To ping Timeout
Configuring Environment References
Environment Variables
Environment References To Other Enterprise JavaBeans
Examples of References to a Local Interface
Accessing EJBs Using Environment References
Examples of References to a Remote Interface
Environment References To Resource Manager Connection Factory References
JDBC DataSource
Mail Session

11 Configuring EJB Application Security

Granting Permissions in Browser
Authenticating and Authorizing EJB Applications
Specifying Users and Groups
Specifying Logical Roles in the EJB Deployment Descriptor
Specifying Unchecked Security for EJB Methods
Specifying the runAs Security Identity
Mapping Logical Roles to Users and Groups
Specifying a Default Role Mapping for Undefined Methods
Specifying Users and Groups by the Client
Specifying Credentials in EJB Clients
Credentials in JNDI Properties
Credentials in the InitialContext

12 EJB Clustering

EJB Clustering Overview
Stateless Session Clustering
Stateful Session Bean Clustering
Combination of HTTP and EJB Clustering
Enabling Clustering For EJBs
Configure the Multicast Address for EJB Clustering
Configure EJB Replication for Stateful Session Beans
VM Termination Replication
End of Call Replication
EJB Clustering Includes JNDI Namespace Replication
Load Balancing Options
Load Balancing Using Static Retrieval
DNS Load Balancing


OC4J-Specific Deployment Descriptor for EJBs
Enterprise Beans Section
Session Bean Section
Entity Bean Section
Message Driven Bean Section
AC4J Active EJB Section
EJB 1.1 CMP Field Mapping Section
Method Definition
Assembly Descriptor Section
Element Description

B Third Party Licenses

Apache HTTP Server