Sun ONE logo      Previous      Contents      Index      Next     

Sun ONE Application Server 7 Developer's Guide to Enterprise Java Beans 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
Product Support

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

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

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 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
sun-cmp-mappings
sun-cmp-mapping
schema
entity-mapping
Specifying the Mapping Components
entity-mapping
ejb-name
table-name
secondary-table
consistency
Specifying Field Mappings
cmp-field-mapping
field-name
column-name
read-only
fetched-with
level
named-group
none
Specifying Relationships
cmr-field-mapping
cmr-field-name
column-pair
column-name
fetched-with
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
check-all-at-commit
check-modified-at-commit
cmp-field-mapping
cmr-field-mapping
cmr-field-name
column-name
column-pair
consistency
ejb-name
entity-mapping
fetched-with
field-name
level
lock-when-loaded
lock-when-modified
named-group
none
read-only
schema
secondary-table
sun-cmp-mapping
sun-cmp-mappings
table-name
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 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
ejb
ejb-name
enterprise-beans
is-read-only-bean
refresh-period-in-seconds
sun-ejb-jar
unique-id
Role Mapping Elements
group-name
principal
principal-name
role-name
security-role-mapping
server-name
Reference Elements
ejb-ref
ejb-ref-name
jndi-name
pass-by-reference
res-ref-name
resource-env-ref
resource-env-ref-name
resource-ref
Messaging Elements
jms-durable-subscription-name
jms-max-messages-load
mdb-connection-factory
Security Elements
as-context
auth-method
caller-propagation
confidentiality
default-resource-principal
establish-trust-in-client
establish-trust-in-target
integrity
ior-security-config
name
password
realm
required
sas-context
transport-config
Persistence Elements
cmp
cmp-resource
concrete-impl
finder
is-one-one-cmp
mapping-properties
method-name
one-one-finders
pc-class
pm-class-generator
pm-config
pm-descriptor
pm-descriptors
pm-identifier
pm-inuse
pm-mapping-factory
pm-version
query-filter
query-params
query-variables
Pooling and Caching Elements
bean-cache
bean-pool
cache-idle-timeout-in-seconds
commit-option
is-cache-overflow-allowed
max-cache-size
max-pool-size
max-wait-time-in-millis
pool-idle-timeout-in-seconds
removal-timeout-in-seconds
resize-quantity
steady-pool-size
victim-selection-policy
Class Elements
gen-classes
local-home-impl
local-impl
remote-home-impl
remote-impl
Sample EJB XML Files
Sample ejb-jar.xml File
Sample sun-ejb-jar.xml File

Appendix A   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

Appendix B   Elements Listings
sun-ejb-jar_2_0-0.dtd File Elements
sun-cmp-mapping_1_0.dtd File Elements

Index


Previous      Contents      Index      Next     


Copyright 2003 Sun Microsystems, Inc. All rights reserved.