Sun ONE logo     Index      Next     
Sun ONE Application Server 7 Developer's Guide to Enterprise Java Beans Technology
816-7151-10
Updated: October 09, 2002



Contents

About This Guide

Who Should Use This Guide
Using the Documentation
How This Guide Is Organized
Related Information
Documentation Conventions
General Conventions
Conventions Referring to Directories
Product Support

Introducing the Sun ONE Application Server Enterprise JavaBeans Technology

Summary of EJB 2.0 Changes
EJB Architecture
Value Added Features
Read-Only Beans
pass-by-reference
Pooling and Caching Features
Monitoring
Integration with Sun ONE Studio 4
Dynamic Deployment and Reloading
About Enterprise JavaBeans
What Is an Enterprise JavaBean?
Types of Beans
EJB Flow
The EJB Container
Interfaces
Home Interface
Remote Interface
Local Interface
Pooling and Caching
Pooling Parameters
Caching Parameters
How Enterprise Beans Access Resources
JNDI Connection
Database Connection
URL Connections
Transaction Management
How Application Security Works
About Developing an Effective Application
General Process for Creating Enterprise Beans
Bean Usage Guidelines
Client View Guidelines
Remote or Local Interface Guidelines
Accessing Sun ONE Application Server Functionality
About EJB Assembly and Deployment

Using Session Beans

About Session Beans
Session Bean Characteristics
The Container
Stateless Container
Stateful Container
Developing Session Beans
Development Requirements
Determining Session Bean Usage
Stateful Session Bean Considerations
Stateless Session Bean Considerations
Providing Interfaces
Creating a Remote Interface
Creating a Local Interface
Creating the Local Home Interface
Creating the Remote Home Interface
Creating the Bean Class Definition
Session Synchronization
Abstract Methods
Restrictions and Optimizations
Optimizing Session Bean Performance
Restricting Transactions

Using Entity Beans

About Entity Beans
Entity Bean Characteristics
The Container
Persistence
Bean-Managed Persistence
Container-Managed Persistence
Read-Only Beans
Developing Entity Beans
Determining Entity Bean Usage
Responsibilities of the Bean Developer
Defining the Primary Key Class
Defining Remote Interfaces
Creating the Remote Home Interface
findByPrimaryKey Method
Example of a Remote Home interface
Defining Local Interfaces
Creating the Local Home Interface
Creating a Local Interface
Creating a Remote Interface
Creating the Bean Class Definition (for Bean-Managed Persistence)
Using ejbCreate
Using ejbActivate and ejbPassivate
Using ejbLoad and ejbStore
Using setEntityContext and unsetEntityContext
Using ejbRemove
Using Finder Methods
Using Read-Only Beans
Read-Only Bean Characteristics and Life Cycle
Read-Only Bean Good Practices
Refreshing Read-Only Beans
Invoking a Transactional Method
Refreshing Periodically
Refreshing Programmatically
Deploying Read Only Beans
Handling Synchronization of Concurrent Access

Using Container-Managed Persistence for Entity Beans

Sun ONE Application Server Support
About Container-Managed Persistence
CMP Components
Relationships
One-to-One Relationships
One-to-Many Relationships
Many-to-Many Relationships
Abstract Schema
Deployment Descriptors
Persistence Manager
Using Container-Managed Persistence
Process Overview
Phase 1. Creating the mapping deployment descriptor file
Phase 2. Generating and compiling concrete beans and delegates
Phase 3. Running in the Sun ONE Application Server runtime
Mapping Capabilities
Mapping Features
Mapping Tool
Mapping Techniques
Supported Data Types for Mapping
BLOB Support
Using the capture-schema Utility
Mapping Fields and Relationships
Specifying the Beans to Be Mapped
Specifying the Mapping Components
Specifying Field Mappings
Specifying Relationships
Configuring the Resource Manager
Using EJB QL
Configuring Queries for 1.1 Finders
Query Filter Expression
Query Parameter
Query Variables
Third-Party Pluggable Persistence Manager API
Restrictions and Optimizations
Unique Database Schema Names in EAR File
Limitations on Container-Managed Persistence Protocol
Restrictions on Remote Interfaces
Elements in the sun-cmp-mappings.xml File
Examples
Sample Schema Definition
Sample CMP Mapping XML File
Sample EJB QL Queries

Using Message-Driven Beans

About Message-Driven Beans
Message-Driven Beans Differences
Message-Driven Bean Characteristics
Transaction Management
Concurrent Message Processing
Developing Message-Driven Beans
Creating the Bean Class Definition
Using ejbCreate
Using setMessageDrivenContext
Using onMessage
Using ejbRemove
Configuration
Connection Factory and Destination
Message-Driven Bean Pool
Server instance-wide Attributes
Automatic Reconnection to JMS Provider
Restrictions and Optimizations
JMS Limitation
Pool Tuning and Monitoring
onMessage Runtime Exception
Sample Message-Driven Bean XML Files
Sample ejb-jar.xml File
Sample sun-ejb-jar.xml File

Handling Transactions with Enterprise Beans

JTA and JTS Transaction Support
About Transaction Handling
Flat Transactions
Global and Local Transactions
Demarcation Models
Container-Managed Transactions
Bean-Managed Transactions
Commit Options
Administration and Monitoring
Using Container-Managed Transactions
Specifying Transaction Attributes
Differing Attribute Requirements
Attribute Values
Rolling Back a Container-Managed Transaction
Synchronizing a Session Bean's Instance Variables
Methods Not Allowed in Container-Managed Transactions
Using Bean-Managed Transactions
Choosing the Type of Transactions
JDBC Transactions
JTA Transactions
Returning Without Committing
Methods Not Allowed in Bean-Managed Transactions
Setting Transaction Timeouts
Handling Isolation Levels

Developing Secure Enterprise Beans

About Secure Enterprise Beans
Authorization and Authentication
Security Roles
Deployment
Defining Security Roles
Declaring Method Permissions
Declaring Security Role References
Specifying Security Identities
The run-as Identity
Using Programmatic Security
Handling Unprotected EJB-Tier Resources

Assembling and Deploying Enterprise Beans

EJB Structure
Creating Deployment Descriptors
Deploying Enterprise Beans
Using the Administration Interface
Using the Command-Line Interface
Using the Sun ONE Studio 4 IDE
Reloading Enterprise Beans
The sun-ejb-jar_2_0-0.dtd File Structure
Subelements
Data
Attributes
Elements in the sun-ejb-jar.xml File
General Elements
Role Mapping Elements
Reference Elements
Messaging Elements
Security Elements
Persistence Elements
Pooling and Caching Elements
Class Elements
Sample EJB XML Files
Sample ejb-jar.xml File
Sample sun-ejb-jar.xml File

CMP Mapping with the Sun ONE Studio 4 Interface

Mapping CMP Beans
Capturing a Schema
Mapping Existing Enterprise Beans to a Schema
Mapping Relationship Fields
EJB Persistence Properties

Elements Listings

sun-ejb-jar_2_0-0.dtd File Elements
sun-cmp-mapping_1_0.dtd File Elements

Index


Index      Next     
Copyright 2002 Sun Microsystems, Inc. All rights reserved.