ibm.com/redbooks
EJB 2.0 Development
with WebSphere Studio
Application Developer
Ueli Wahli
Wouter Denayer
Lars Schunk
Deborah Shaddon
Martin Weiss
Learn about the EJB 2.0 specification
Develop EJBs with Studio
Application Developer
Deploy EJBs to WebSphere
Application Server
Front cover
EJB 2.0 Development with WebSphere Studio
Application Developer
April 2003
International Technical Support Organization
SG24-6819-00
© Copyright International Business Machines Corporation 2003. All rights reserved.
Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP Schedule
Contract with IBM Corp.
First Edition (April 2003)
This edition applies to Version 5 of WebSphere Studio Application Developer and WebSphere
Application Server and to the Enterprise JavaBean specification 2.0.
This book is similar to the redbook
EJB Development with VisualAge for Java for WebSphere
Application Server
, SG24-6144, but uses WebSphere Studio Application Developer as the
development tool.
Note: Before using this information and the product it supports, read the information in
“Notices” on page xix.
© Copyright IBM Corp. 2003. All rights reserved. iii
Contents
Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
The team that wrote this redbook. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii
Become a published author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
Comments welcome. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiv
Part 1. EJB architecture and concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Chapter 1. Introduction to Enterprise JavaBeans . . . . . . . . . . . . . . . . . . . . 3
Server-side component architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Background. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Why EJBs?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Object distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Portable component-based architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Object persistence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Independence from database schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Transaction management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Multiple data sources with transactional capabilities. . . . . . . . . . . . . . . . . . . 8
Middle-tier architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Multiple client types accessing shared data . . . . . . . . . . . . . . . . . . . . . . . . . 9
Concurrent read and update access to shared data . . . . . . . . . . . . . . . . . . . 9
Method-level object security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Multiple servers to handle throughput and availability . . . . . . . . . . . . . . . . 10
Integration with CORBA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Development roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Java 2 Platform, Enterprise Edition (J2EE) . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
J2EE services summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Java servlets and JavaServer Pages (JSP) . . . . . . . . . . . . . . . . . . . . . . . . 12
Enterprise JavaBeans (EJB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
JDBC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Java remote method invocation and RMI-IIOP . . . . . . . . . . . . . . . . . . . . . . 13
Java Naming and Directory Interface (JNDI) . . . . . . . . . . . . . . . . . . . . . . . 13
Java Messaging Service (JMS). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Java Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Java Activation Framework (JAF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Java Transaction API (JTA) and Java Transaction Service (JTS) . . . . . . . 14
Java IDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14