Skip Headers
Oracle® Fusion Middleware Programming Enterprise JavaBeans for Oracle WebLogic Server
11
g
Release 1 (10.3.1)
Part Number E13719-02
Home
Book List
Contact Us
Next
View PDF
Contents
Title and Copyright Information
Preface
Documentation Accessibility
Conventions
1
Introduction and Roadmap
Document Scope and Audience
Guide to this Document
Related Documentation
Samples and Tutorials for the EJB Developer
Avitek Medical Records Application (MedRec) and Tutorials
EJB Examples in the WebLogic Server Distribution
New and Changed Features in This Release
2
Understanding Enterprise JavaBeans
How Do Applications Use EJBs?
Session EJBs Implement Business Logic
Stateless Session Beans
Stateful Session Beans
Entity EJBs Maintain Persistent Data
Message-Driven Beans Implement Loosely Coupled Business Logic
EJB Anatomy and Environment
EJB Components
The EJB Container
EJB Deployment Descriptors
Key Deployment Element Mappings
Bean and Resource References
Security Roles
EJBs, Clients, and Application Objects
EJB Communications
EJBs and Message Destination References
WebLogic Server Value-Added EJB Features
Performance-Enhancing Features for WebLogic Server EJBs
Pooling Improves EJB Response Time
Caching Improves EJB Performance
Additional Caching Capabilities for CMP Entities
Field Groups for Efficient Queries (CMP Entities)
Configurable Write Behaviors
Operation Ordering and Batching (CMP Entities)
Optimized Database Updates (CMP Entities)
Read-Only Pattern and Read-Only Invalidation (CMP Entities)
CMP Beans Increase Developer Productivity
Automatic Primary Key Generation (CMP Entities)
Automatic Table Creation (CMP Entities)
Dynamic Queries (CMP Entities)
Reliability and Availability Features
Load Balancing Among Clustered EJBs Increases Scalability
Failover for Clustered EJBs Increases Reliability
Securing EJBs
3
Designing Enterprise Java Beans
Choosing the Right Bean Type
Session Bean Features
Stateful Session Beans
Stateless Session Beans
Stateless Beans Offer Performance and Scalability Advantages
Exposing Stateless Session Beans as Web Services
Entity Bean Features
Key Features of Entity Beans
Read-Write versus Read-Only Entity Beans
Entity Bean Performance and Data Consistency Characteristics
Message-Driven Beans
Persistence Management Alternatives
Use Container-Managed Persistence (CMP) for Productivity and Portability
Use Bean-Managed Persistence (BMP) Only When Necessary
Transaction Design and Management Options
Understanding Transaction Demarcation Strategies and Performance
Demarcating Transactions at the Server Level is Most Efficient
Container-Managed Transactions Are Simpler to Develop and Perform Well
Rollback
Transaction Boundaries
Distributing Transactions Across Beans
Costly Option: Distributing Transactions Across Databases
Bean-Level Transaction Management
When to Use Bean-Managed Transactions
Keep Bean-Managed Transactions Short
Client-Level Transaction Management is Costly
Transaction Isolation: A Performance vs. Data Consistency Choice
Satisfying Application Requirements with WebLogic Server EJBs
4
Implementing Enterprise Java Beans
Overview of the EJB Development Process
Create a Source Directory
Create EJB Classes and Interfaces
Using WebLogic Server Generic Bean Templates
Programming Client Access to EJBs
Programming Client to Obtain Initial Context
Programming Client to Look Up a Home Interface
Using EJB Links
Configuring EJBs to Send Requests to a URL
Specifying an HTTP Resource by URL
Specifying an HTTP Resource by Its JNDI Name
Accessing HTTP Resources from Bean Code
Configuring Network Communications for an EJB
Programming and Configuring Transactions
Programming Container-Managed Transactions
Configuring Automatic Retry of Container-Managed Transactions
Programming Bean-Managed Transactions
Programming Transactions That Are Distributed Across EJBs
Calling multiple EJBs from a client's transaction context
Using an EJB "Wrapper" to Encapsulate a Cross-EJB Transaction
Programming the EJB Timer Service
Clustered Versus Local EJB Timer Services
Clustered EJB Timer Services
Local EJB Timer Services
Using Java Programming Interfaces to Program Timer Objects
EJB 2.1 Timer-related Programming Interfaces
WebLogic Server-specific Timer-related Programming Interfaces
Timer Deployment Descriptors
Configuring Clustered EJB Timers
Declare Web Service References
Compile Java Source
Generate Deployment Descriptors
Edit Deployment Descriptors
Security Elements
Resource Mapping Elements
Persistence Elements
Clustering Elements
Data Consistency Elements
Container-Managed Transactions Elements
Performance Elements
Network Communications Elements
Generate EJB Wrapper Classes, and Stub and Skeleton Files
appc and Generated Class Name Collisions
Package
Packaging Considerations for EJBs with Clients in Other Applications
Deploy
Solving Problems During Development
Adding Line Numbers to Class Files
Monitoring Data
Creating Debug Messages
WebLogic Server Tools for Developing EJBs
Oracle JDeveloper
Oracle Enterprise Pack for Eclipse
Administration Console
javac
EJBGen
DDInit
WebLogic Server Ant Utilities
weblogic.Deployer
appc
DDConverter
Comparison of EJB Tool Features
5
Session EJBs
Comparing Stateless and Stateful Session Beans
Pooling for Stateless Session EJBs
Caching and Passivating Stateful Session EJBs
Stateful Session EJB Creation
Stateful Session EJB Passivation
Controlling Passivation
Eager Passivation (LRU)
Lazy Passivation (NRU)
Specifying the Persistent Store Directory for Passivated Beans
Configuring Concurrent Access to Stateful Session Beans
Design Decisions for Session Beans
Choosing Between Stateless and Stateful Beans
Choosing the Optimal Free Pool Setting for Stateless Session Beans
Implementing Session Beans
WebLogic-Specific Configurable Behaviors for Session Beans
6
Entity EJBs
Managing Entity Bean Pooling and Caching
Understanding Entity Pooling
Understanding Entity Caching
Understanding Passivation of Entity Beans
Understanding ejbLoad() and ejbStore() Behavior
Controlling the Behavior of ejbLoad() and ejbStore()
Disabling Cache Flushing
Configuring Application-Level Caching
Using Primary Keys
Specifying Primary Keys and Primary Key Classes
Guidelines for Primary Keys
Automatically Generating Primary Keys
Specifying Automatic Key Generation for Oracle Databases
Specifying Automatic Key Generation for Microsoft SQL Server
Generating Primary Keys with a Named Sequence Table
Declaring Primary Key Field Type
Support for Oracle Database SEQUENCE
String-Valued CMP Field Trimming
Benefits of String Trimming
Disabling String Trimming
Configuring Entity EJBs for Database Operations
Configuring Table Mapping
Automatic Table Creation (Development Only)
Delaying Database Inserts
Why Delay Database Inserts?
Configuring Delayed Database Inserts
Limiting Database Reads with cache-between-transactions
Updating the Database Before Transaction Ends
Dynamic Queries
Enabling Dynamic Queries
Executing Dynamic Queries
Enabling BLOB and CLOB Column Support for Oracle or DB2 Databases
Specifying a BLOB Column Using the Deployment Descriptor
Serialization for cmp-fields of Type byte[] Mapped to an Oracle Blob
Specifying a CLOB Column Using the Deployment Descriptor
Optimized CLOB Column Insertion on Oracle 10g
Specifying Field Groups
Ordering and Batching Operations
Operation Ordering
Batch Operations Guidelines and Limitations
Using Query Caching (Read-Only Entity Beans)
Using SQL in Entity Beans
Using Container-Managed Relationships (CMRs)
CMR Requirements and Limitations
CMR Cardinality
CMR Direction
Removing CMRs
Defining Container-Managed Relationships (CMRs)
Specifying Relationships in ejb-jar.xml
Specifying Relationship Cardinality
Specifying Relationship Directionality
Specifying Relationships in weblogic-cmp-jar.xml
One-to-One and One-to-Many Relationships
Many-to-Many Relationships
Specifying CMRs for EJBs that Map to Multiple Tables
About CMR Fields and CMR Field Accessor Methods
Using Cascade Delete for Entities in CMRs
Relationship Caching
Enabling Relationship Caching
Choosing a Concurrency Strategy
Exclusive Concurrency
Database Concurrency
Optimistic Concurrency
Preventing Stale Optimistic Bean Data
Explicit Invalidation of Optimistic Beans
Invalidation Options for Optimistic Concurrency in Clusters
Check Data for Validity with Optimistic Concurrency
Optimistic Concurrency and Oracle Databases
Read Only Concurrency
Concurrency Strategy Trade-Offs
Configuring Concurrency Strategy
Deadlock Prevention for Exclusive Concurrency and Cascade Deletes
Using the Read-Mostly Pattern
Configuring Entity Beans for Read-Mostly Pattern
Invalidating Read-Only Entity EJBs Implicitly
Invalidating Entity EJBs Explicitly
CMP Entity Bean Descriptors Element by Feature
Container-Managed Relationship Elements
Primary Key Elements
7
Message-Driven EJBs
8
Deployment Guidelines for Enterprise Java Beans
Before You Deploy an EJB
Understanding and Performing Deployment Tasks
Deployment Guidelines for EJBs
Deploy EJBs as Part of an Enterprise Application
Deploy EJBs That Call Each Other in the Same Application
Deploying EJBs that Use Dependency Injection
Deploy Homogeneously to a Cluster
Deploying Pinned EJBs to a Cluster
Redeploying an EJB
Using FastSwap Deployment to Minimize Deployment
Understanding Warning Messages
Disabling EJB Deployment Warning Messages
A
Deployment Descriptor Schema and Document Type Definitions Reference
XML Schema Definitions and Namespace Declarations
weblogic-ejb-jar.xml Namespace Declaration and Schema Location
weblogic-cmp-jar.xml Namespace Declaration and Schema Location
ejb-jar.xml Namespace Declaration and Schema Location
Document Type Definitions and DOCTYPE Header Information
B
weblogic-ejb-jar.xml Deployment Descriptor Reference
2.1 weblogic-ejb-jar.xml File Structure
2.1 weblogic-ejb-jar.xml Elements
allow-concurrent-calls
Function
Example
allow-remove-during-transaction
Function
Example
cache-between-transactions
Function
Example
cache-type
Function
Example
client-authentication
Function
Example
client-cert-authentication
Function
Example
clients-on-same-server
Function
Example
component-factory-class-name
Function
concurrency-strategy
Function
Example
confidentiality
Function
Example
connection-factory-jndi-name
Function
Example
connection-factory-resource-link
Function
create-as-principal-name
Function
delay-updates-until-end-of-tx
Function
Example
description
Function
Example
destination-jndi-name
Function
Example
destination-resource-link
Function
disable-warning
Function
Example
dispatch-policy
Function
Example
distributed-destination-connection
Function
Example
durable-subscription-deletion
Function
Example
ejb-local-reference-description
Function
Example
ejb-name
Function
Example
ejb-reference-description
Function
Example
ejb-ref-name
Function
Example
enable-bean-class-redeploy
Function
Example
enable-call-by-reference
Function
Example
enable-dynamic-queries
Function
Example
entity-always-uses-transaction
Function
entity-cache
Function
Example
entity-cache-name
Function
Example
entity-cache-ref
Function
Example
entity-clustering
Function
Example
entity-descriptor
Function
Example
estimated-bean-size
Function
Example
externally-defined
Function
finders-load-bean
Function
Example
generate-unique-jms-client-id
Function
global-role
home-call-router-class-name
Function
Example
home-is-clusterable
Function
Example
home-load-algorithm
Function
Example
idempotent-methods
Function
Example
identity-assertion
Function
Example
idle-timeout-seconds
Function
Example
iiop-security-descriptor
Function
Example
init-suspend-seconds
Function
initial-beans-in-free-pool
Function
Example
initial-context-factory
Function
Example
integrity
Function
Example
invalidation-target
Function
Example
is-modified-method-name
Function
Example
isolation-level
Function
Oracle Database-Only Isolation Levels
Example
jms-client-id
Function
Example
jms-polling-interval-seconds
Function
Example
jndi-name
Function
Example
local-jndi-name
Function
Example
max-beans-in-cache
Function
Example
max-beans-in-free-pool
Function
Example
max-messages-in-transaction
Function
max-queries-in-cache
Function
max-suspend-seconds
Function
message-destination-descriptor
Function
Example
message-destination-name
Function
Example
message-driven-descriptor
Function
Example
method
Function
Example
method-intf
Function
Example
method-name
Function
Example
method-param
Function
Example
method-params
Function
Example
network-access-point
Function
Example
passivate-as-principal-name
Function
persistence
Function
Example
persistence-use
Function
Example
persistent-store-dir
Function
Example
persistent-store-logical-name
Function
pool
Function
Example
principal-name
Function
Example
provider-url
Function
Example
read-timeout-seconds
Function
Example
remote-client-timeout
Function
Example
remove-as-principal-name
Function
replication-type
Function
Example
resource-env-ref-name
Function
Example
res-ref-name
Function
Example
resource-adapter-jndi-name
Function
resource-description
Function
Example
resource-env-description
Function
Example
resource-link
Function
Example
retry-count
Function
retry-methods-on-rollback
Function
role-name
Function
Example
run-as-identity-principal
Function
Example
run-as-principal-name
Function
Example
run-as-role-assignment
Function
Example
A_EJB_with_runAs_role_X
B_EJB_with_runAs_role_X
C_EJB_with_runAs_role_Y
security-permission
Function
Example
security-permission-spec
Function
Example
security-role-assignment
Function
Example
service-reference-description
Function
Example
session-timeout-seconds
Function
Example
stateful-session-cache
Function
Example
stateful-session-clustering
Function
Example
stateful-session-descriptor
Function
Example
stateless-bean-call-router-class-name
Function
Example
stateless-bean-is-clusterable
Function
Example
stateless-bean-load-algorithm
Function
Example
stateless-bean-methods-are-idempotent
Function
Example
stateless-clustering
Function
Example
stateless-session-descriptor
Function
Example
stick-to-first-server
Function
Example
timer-descriptor
Function
timer-implementation
Function
Example
transaction-descriptor
Function
Example
transaction-isolation
Function
Example
transport-requirements
Function
Example
trans-timeout-seconds
Function
Example
type-identifier
Function
Example
type-storage
Function
Example
type-version
Function
Example
use-serverside-stubs
Function
Example
use81-style-polling
Function
Example
weblogic-compatibility
Function
weblogic-ejb-jar
Function
weblogic-enterprise-bean
Function
work-manager
Function
C
weblogic-cmp-jar.xml Deployment Descriptor Reference
2.1 weblogic-cmp-jar.xml Deployment Descriptor File Structure
2.1 weblogic-cmp-jar.xml Deployment Descriptor Elements
allow-readonly-create-and-remove
Function
Example
automatic-key-generation
Function
Example
caching-element
Function
Example
caching-name
Function
Example
check-exists-on-method
Function
Example
cluster-invalidation-disabled
Function
Example
cmp-field
Function
Example
cmr-field
Function
Example
column-map
Function
Example
compatibility
Function
Example
create-default-dbms-table
Function
Automatic Table Creation
Automatic Oracle Database SEQUENCE Generation
Example
database-specific-sql
Function
Example
database-type
Function
Example
data-source-jndi-name
Function
Example
db-cascade-delete
Function
Setting up Oracle Database for Cascade Delete
Example
dbms-column
Function
Example
dbms-column-type
Function
Example
dbms-default-value
Function
Example
default-dbms-tables-ddl
Function
delay-database-insert-until
Function
Example
description
Function
Example
disable-string-trimming
Function
Example
ejb-name
Function
Example
ejb-ql-query
Function
Example
enable-batch-operations
Function
Example
enable-query-caching
Function
Example
field-group
Function
Example
field-map
Function
Example
finders-return-nulls
Function
Example
foreign-key-column
Function
Example
foreign-key-table
Function
Example
generator-name
Function
Example
generator-type
Function
Example
group-name
Function
Example
include-updates
Function
Example
instance-lock-order
Function
Example
key-cache-size
Function
Example
key-column
Function
Example
lock-order
Function
Example
max-elements
Function
Example
method-name
Function
Example
method-param
Function
Example
method-params
Function
Example
optimistic-column
Function
Example
order-database-operations
Function
Example
pass-through-columns
Function
Example
primary-key-table
Function
Example
query-method
Function
Example
relation-name
Function
Example
relationship-caching
Function
Example
relationship-role-map
Function
Example
Mapping a Bean on Foreign Key Side of a Relationship to Multiple Tables
Mapping a Bean on Primary Key Side of a Relationship to Multiple Tables
relationship-role-name
Function
Example
serialize-byte-array-to-oracle-blob
Function
Example
serialize-char-array-to-bytes
Function
Example
sql
Function
Example
sql-query
Function
Example
sql-select-distinct
Function
Example
sql-shape
Function
Example
sql-shape-name
Function
Example
table-map
Function
Example
table-name
Function
Example
trigger-updates-optimistic-column
Function
Example
unknown-primary-key-field
Function
Example
use-select-for-update
Function
Example
validate-db-schema-with
Function
Example
verify-columns
Function
Example
verify-rows
Function
Example
version-column-initial-value
Function
Example
weblogic-ql
Function
Example
weblogic-query
Function
Example
weblogic-rdbms-bean
Function
Example
weblogic-rdbms-jar
Function
Example
weblogic-rdbms-relation
Function
Examples
Defining a One-to-One Relationship
Defining a One-to-Many Relationship
Defining a Many-to-Many Relationship
weblogic-relationship-role
Function
Example
D
appc Reference
appc
Advantages of Using appc
appc Syntax
Designating Alternative Deployment Descriptors
appc Options
appc and EJBs
E
EJBGen Reference
Running EJBGen
EJBGen Distribution and Examples
Invoking EJBGen
EJBGen Command Options
Using Key EJBGen Features
Controlling the Files EJBGen Generates
Using Property Files with EJBGen
Using User Variables
Using Predefined Variables
Surround Attributes that Contain Spaces With Double Quotes
EJBGen Supports Tag Inheritance
Examples of EJBGen Tag Usage
Mapping an Entity Bean to Several Tables with EJBGen
Specifying Relationship Caching with EJBGen Tags
Specifying Relationships with EJBGen Tags
Upgrading Relationships to Use Local Interfaces
Enum Attribute Constant Values
Constants.Bool
Constants.TransactionAttribute
Constants.IsolationLevel
Constants.RefType
Constants.HomeLoadAlgorithm
Constants.Interface
Constants.ConcurrencyStrategy
EJBGen Annotation Reference
EJB Container Annotations
weblogic.ejbgen.ActivationConfigProperties
weblogic.ejbgen.ActivationConfigProperty
Attributes
weblogic.ejbgen.AutomaticKeyGeneration
Attributes
weblogic.ejbgen.CmpField
Attributes
weblogic.ejbgen.CmrField
Attributes
weblogic.ejbgen.Compatibility
Attributes
weblogic.ejbgen.CreateDefaultDbmsTables
weblogic.ejbgen.CreateDefaultRdbmsTables
weblogic.ejbgen.DBSpecificSQL
Attributes
weblogic.ejbgen.EjbClientJar
weblogic.ejbgen.EjbInterface (deprecated)
Attributes
weblogic.ejbgen.EjbLocalRef
Attributes
weblogic.ejbgen.EjbLocalRefs
weblogic.ejbgen.EjbRef
Attributes
weblogic.ejbgen.EjbRefs
weblogic.ejbgen.Entity
Attributes
weblogic.ejbgen.EntityCacheRef
Attributes
weblogic.ejbgen.EnvEntries
weblogic.ejbgen.EnvEntry
Attributes
weblogic.ejbgen.FileGeneration
Attributes
weblogic.ejbgen.Finder
Attributes
weblogic.ejbgen.Finders
weblogic.ejbgen.ForeignJmsProvider
Attributes
weblogic.ejbgen.JarSettings
Attributes
weblogic.ejbgen.JndiName
Attributes
weblogic.ejbgen.LocalHomeMethod
Attributes
weblogic.ejbgen.LocalMethod
Attributes
weblogic.ejbgen.MessageDestination
Attributes
weblogic.ejbgen.MessageDestinationRef
Attributes
weblogic.ejbgen.MessageDestinationRefs
weblogic.ejbgen.MessageDestinations
weblogic.ejbgen.MessageDriven
Attributes
weblogic.ejbgen.MethodIsolationLevelPattern
Attributes
weblogic.ejbgen.MethodIsolationLevelPatterns
weblogic.ejbgen.MethodPermissionPattern
Attributes
weblogic.ejbgen.MethodPermissionPatterns
weblogic.ejbgen.PrimKeyField
weblogic.ejbgen.Relation
Attributes
weblogic.ejbgen.Relations
weblogic.ejbgen.RelationshipCachingElement
Attributes
weblogic.ejbgen.RelationshipCachingElements
weblogic.ejbgen.RemoteHomeMethod
Attributes
weblogic.ejbgen.RemoteMethod
Attributes
weblogic.ejbgen.ResourceEnvRef
Attributes
weblogic.ejbgen.ResourceEnvRefs
weblogic.ejbgen.ResourceRef
Attributes
weblogic.ejbgen.ResourceRefs
weblogic.ejbgen.RoleMapping
Attributes
weblogic.ejbgen.RoleMappings
weblogic.ejbgen.SecurityRoleRef
Attributes
weblogic.ejbgen.SecurityRoleRefs
weblogic.ejbgen.Select
Attributes
weblogic.ejbgen.ServiceEndpointMethod
Attributes
weblogic.ejbgen.ServiceRef
Attributes
weblogic.ejbgen.ServiceRefs
weblogic.ejbgen.Session
Attributes
weblogic.ejbgen.SqlFinder
Attributes
weblogic.ejbgen.SqlFinders
weblogic.ejbgen.SqlShape
Attributes
weblogic.ejbgen.SqlShapeTable
Attributes
weblogic.ejbgen.SqlShapes
weblogic.ejbgen.ValueObject
Attributes
weblogic.ejbgen.ValueObjectField
Attributes
F
Important Information for EJB 1.1 Users
Writing for RDBMS Persistence for EJB 1.1 CMP
Finder Signature
finder-list Element
finder-query Element
Using WebLogic Query Language (WLQL) for EJB 1.1 CMP
WLQL Syntax
WLQL Operators
WLQL Operands
Examples of WLQL Expressions
Using SQL for CMP 1.1 Finder Queries
Tuned EJB 1.1 CMP Updates in WebLogic Server
Using is-modified-method-name to Limit Calls to ejbStore()
5.1 weblogic-ejb-jar.xml Deployment Descriptor File Structure
5.1 weblogic-ejb-jar.xml Deployment Descriptor Elements
caching-descriptor
max-beans-in-free-pool
initial-beans-in-free-pool
max-beans-in-cache
idle-timeout-seconds
cache-strategy
read-timeout-seconds
persistence-descriptor
is-modified-method-name
delay-updates-until-end-of-tx
persistence-type
db-is-shared
stateful-session-persistent-store-dir
persistence-use
clustering-descriptor
home-is-clusterable
home-load-algorithm
home-call-router-class-name
stateless-bean-is-clusterable
stateless-bean-load-algorithm
stateless-bean-call-router-class-name
stateless-bean-methods-are-idempotent
transaction-descriptor
trans-timeout-seconds
reference-descriptor
resource-description
ejb-reference-description
enable-call-by-reference
jndi-name
transaction-isolation
isolation-level
Oracle-Only Isolation Levels
method
security-role-assignment
1.1 weblogic-cmp-jar.xml Deployment Descriptor File Structure
1.1 weblogic-cmp-jar.xml Deployment Descriptor Elements
RDBMS Definition Elements
enable-tuned-updates
pool-name
schema-name
table-name
EJB Field-Mapping Elements
attribute-map
object-link
bean-field
dbms-column
Finder Elements
finder-list
finder
method-name
method-params
method-param
finder-query
finder-expression
G
EJB Query Language (EJB-QL) and WebLogic Server
EJB QL Requirement for EJB 2.x Beans
Using the EJB 2.x WebLogic QL Extension for EJB QL
upper and lower Functions
upper
lower
Using ORDER BY
Using Subqueries
Subquery Return Types
Subqueries as Comparison Operands
Correlated and Uncorrelated Subqueries
DISTINCT Clause with Subqueries
Using Arithmetic Functions
Using Aggregate Functions
Using Queries that Return ResultSets
Using Oracle SELECT HINTS
"get" and "set" Method Restrictions
Properties-Based Methods of the Query Interface
Migrating from WLQL to EJB QL
Known Issue with Implied Cross Products
EJB QL Error-Reporting
Visual Indicator of Error in Query
Multiple Errors Reported after a Single Compilation
Scripting on this page enhances content navigation, but does not change the content in any way.