Sun ONE Application Server 7 Developer's Guide to Enterprise Java Beans Technology |
816-7151-10 |
Updated: October 09, 2002 |
ContentsWho Should Use This Guide
Using the Documentation
How This Guide Is Organized
Related Information
Documentation Conventions
General Conventions
Product Support
Conventions Referring to Directories
Introducing the Sun ONE Application Server Enterprise JavaBeans Technology
Summary of EJB 2.0 Changes
EJB Architecture
Value Added Features
Read-Only Beans
About Enterprise JavaBeans
pass-by-reference
Pooling and Caching Features
Monitoring
Integration with Sun ONE Studio 4
Dynamic Deployment and Reloading
What Is an Enterprise JavaBean?
About Developing an Effective Application
Types of Beans
EJB Flow
The EJB Container
Interfaces
Home Interface
Pooling and Caching
Remote Interface
Local Interface
Pooling Parameters
How Enterprise Beans Access Resources
Caching Parameters
JNDI Connection
Transaction Management
Database Connection
URL Connections
How Application Security Works
General Process for Creating Enterprise Beans
About EJB Assembly and Deployment
Bean Usage Guidelines
Client View Guidelines
Remote or Local Interface Guidelines
Accessing Sun ONE Application Server Functionality
About Session Beans
Session Bean Characteristics
Developing Session Beans
The Container
Stateless Container
Stateful Container
Development Requirements
Restrictions and Optimizations
Determining Session Bean Usage
Stateful Session Bean Considerations
Providing Interfaces
Stateless Session Bean Considerations
Creating a Remote Interface
Creating the Bean Class Definition
Creating a Local Interface
Creating the Local Home Interface
Creating the Remote Home Interface
Session Synchronization
Abstract Methods
Optimizing Session Bean Performance
Restricting Transactions
About Entity Beans
Entity Bean Characteristics
Developing Entity Beans
The Container
Persistence
Bean-Managed Persistence
Read-Only Beans
Container-Managed Persistence
Determining Entity Bean Usage
Using Read-Only Beans
Responsibilities of the Bean Developer
Defining the Primary Key Class
Defining Remote Interfaces
Creating the Remote Home Interface
Defining Local Interfaces
findByPrimaryKey Method
Example of a Remote Home interface
Creating the Local Home Interface
Creating the Bean Class Definition (for Bean-Managed Persistence)
Creating a Local Interface
Creating a Remote Interface
Using ejbCreate
Using ejbActivate and ejbPassivate
Using ejbLoad and ejbStore
Using setEntityContext and unsetEntityContext
Using ejbRemove
Using Finder Methods
Read-Only Bean Characteristics and Life Cycle
Handling Synchronization of Concurrent Access
Read-Only Bean Good Practices
Refreshing Read-Only Beans
Invoking a Transactional Method
Deploying Read Only Beans
Refreshing Periodically
Refreshing Programmatically
Using Container-Managed Persistence for Entity Beans
Sun ONE Application Server Support
About Container-Managed Persistence
CMP Components
Using Container-Managed Persistence
Relationships
One-to-One Relationships
Abstract Schema
One-to-Many Relationships
Many-to-Many Relationships
Deployment Descriptors
Persistence Manager
Process Overview
Third-Party Pluggable Persistence Manager API
Phase 1. Creating the mapping deployment descriptor file
Mapping Capabilities
Phase 2. Generating and compiling concrete beans and delegates
Phase 3. Running in the Sun ONE Application Server runtime
Mapping Features
Supported Data Types for Mapping
Mapping Tool
Mapping Techniques
BLOB Support
Using the capture-schema Utility
Mapping Fields and Relationships
Specifying the Beans to Be Mapped
Configuring the Resource Manager
Specifying the Mapping Components
Specifying Field Mappings
Specifying Relationships
Using EJB QL
Configuring Queries for 1.1 Finders
Query Filter Expression
Query Parameter
Query Variables
Restrictions and Optimizations
Unique Database Schema Names in EAR File
Elements in the sun-cmp-mappings.xml File
Limitations on Container-Managed Persistence Protocol
Restrictions on Remote Interfaces
Examples
Sample Schema Definition
Sample CMP Mapping XML File
Sample EJB QL Queries
About Message-Driven Beans
Message-Driven Beans Differences
Developing Message-Driven Beans
Message-Driven Bean Characteristics
Transaction Management
Concurrent Message Processing
Creating the Bean Class Definition
Restrictions and Optimizations
Using ejbCreate
Configuration
Using setMessageDrivenContext
Using onMessage
Using ejbRemove
Connection Factory and Destination
Message-Driven Bean Pool
Server instance-wide Attributes
Automatic Reconnection to JMS Provider
JMS Limitation
Sample Message-Driven Bean XML Files
Pool Tuning and Monitoring
onMessage Runtime Exception
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
Using Container-Managed Transactions
Global and Local Transactions
Demarcation Models
Container-Managed Transactions
Commit Options
Bean-Managed Transactions
Administration and Monitoring
Specifying Transaction Attributes
Using Bean-Managed Transactions
Differing Attribute Requirements
Rolling Back a Container-Managed Transaction
Attribute Values
Synchronizing a Session Bean's Instance Variables
Methods Not Allowed in Container-Managed Transactions
Choosing the Type of Transactions
Setting Transaction Timeouts
JDBC Transactions
Returning Without Committing
JTA Transactions
Methods Not Allowed in Bean-Managed Transactions
Handling Isolation Levels
Developing Secure Enterprise Beans
About Secure Enterprise Beans
Authorization and Authentication
Defining Security Roles
Security Roles
Deployment
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
The sun-ejb-jar_2_0-0.dtd File Structure
Using the Command-Line Interface
Using the Sun ONE Studio 4 IDE
Reloading Enterprise Beans
Subelements
Elements in the sun-ejb-jar.xml File
Data
Attributes
General Elements
Sample EJB XML Files
Role Mapping Elements
Reference Elements
Messaging Elements
Security Elements
Persistence Elements
Pooling and Caching Elements
Class Elements
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
EJB Persistence Properties
Mapping Existing Enterprise Beans to a Schema
Mapping Relationship Fields
sun-ejb-jar_2_0-0.dtd File Elements
sun-cmp-mapping_1_0.dtd File Elements