Sun Java logo     Copyright      Index      Next     

Sun logo
Sun Java System Application Server Standard and Enterprise Edition 7 2004Q2 Developer's Guide to Enterprise JavaBeans Technology 

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
Contacting Sun
Give Us Feedback
Obtain Training
Contact Product Support

Chapter 1   Sun Java System Application Server and 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 5
Dynamic Deployment and Reloading
High Availability and Load Balancing
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 Java System Application Server Functionality
About EJB Assembly and Deployment

Chapter 2   Using Session Beans
About Session Beans
Session Bean Characteristics
The Container
Stateless Container
Stateful Container
Developing Session Beans
Development Requirements
Determining Session Bean Usage
Stateless Session Bean Considerations
Stateful 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
Stateful Session Bean Failover (Enterprise Edition)
Choosing a Persistence Store
Using the Administration Interface
Editing the server.xml File
Enabling SFSB Checkpointing
Server Instance and EJB Container Levels
Application and EJB Module Levels
SFSB Level
Specifying SFSB Methods to Be Checkpointed
Restrictions and Optimizations
Optimizing Session Bean Performance
Restricting Transactions

Chapter 3   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

Chapter 4   Using Container-Managed Persistence for Entity Beans
Sun Java System 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 Java System 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
Data Aliasing
Eager Loading of Field State
Restrictions on Remote Interfaces
Sybase Finder Limitation
Date and Time Fields as CMP Field Types
Elements in the sun-cmp-mappings.xml File
Examples
Sample Schema Definition
Sample CMP Mapping XML File
Sample EJB QL Queries

Chapter 5   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

Chapter 6   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

Chapter 7   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

Chapter 8   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 5 IDE
Reloading Enterprise Beans
Deploying to a Cluster (Enterprise Edition)
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

Appendix A   CMP Mapping with the Sun ONE Studio 5 Interface
Mapping CMP Beans
Capturing a Schema
Mapping Existing Enterprise Beans to a Schema
Mapping Relationship Fields
EJB Persistence Properties

Appendix B   Elements Listings
sun-ejb-jar.xml File Elements
sun-cmp-mappings.xml File Elements

Index


Copyright      Index      Next     


Copyright 2004 Sun Microsystems, Inc. All rights reserved.