enterprise javabeans developer's guide 1997.pdf
(
2809 KB
)
Pobierz
Enterprise JavaBeans™ Developer’s Guide
Enterprise JavaBeans
™
Developer’s Guide
VERSION 6
Borland
®
JBuilder
™
Borland Software Corporation
100 Enterprise Way, Scotts Valley, CA 95066-3249
www.borland.com
Refer to the file DEPLOY.TXT located in the
redist
directory of your JBuilder product for a complete list of files that
you can distribute in accordance with the JBuilder License Statement and Limited Warranty.
Borland Software Corporation may have patents and/or pending patent applications covering subject matter in this
document. Please refer to the product CD or the About dialog box for the list of applicable patents. The furnishing of
this document does not give you any license to these patents.
C
OPYRIGHT
© 1997–2001 Borland Software Corporation. All rights reserved. All Borland brand and product names
are trademarks or registered trademarks of Borland Software Corporation in the United States and other countries.
All other marks are the property of their respective owners.
For third-party conditions and disclaimers, see the Release Notes on your JBuilder product CD.
Printed in the U.S.A.
JBE0060WW21004entjb 3E3R1001
0102030405-9 8 7 6 54321
PDF
Contents
Chapter 1
Introduction 1-1
Documentation conventions . . . . . . . . . . . 1-1
Note to Macintosh users . . . . . . . . . . . . 1-3
Contacting Borland developer support . . . . . 1-4
Online resources . . . . . . . . . . . . . . . . 1-4
World Wide Web . . . . . . . . . . . . . . . . 1-4
Borland newsgroups . . . . . . . . . . . . . . 1-5
Usenet newsgroups . . . . . . . . . . . . . . 1-5
Reporting bugs . . . . . . . . . . . . . . . . . 1-5
Chapter 4
Setting up the target application
server 4-1
The created libraries . . . . . . . . . . . . . . . . 4-3
Adding application server files to your
project . . . . . . . . . . . . . . . . . . . . . . . 4-4
Making the ORB available to JBuilder . . . . . . 4-4
Selecting an application server . . . . . . . . . . 4-4
Setting up JDBC drivers . . . . . . . . . . . . . . 4-5
Creating the .library and .config files . . . . . 4-6
Adding the JDBC driver to projects . . . . . . 4-7
Chapter 2
Programming for the Java™ 2
Platform, Enterprise Edition 2-1
Why are J2EE applications desirable? . . . . . . 2-1
Benefits of the multi-tier model . . . . . . . . 2-3
How JBuilder can help . . . . . . . . . . . . . . 2-5
Client tier technologies . . . . . . . . . . . . 2-5
Middle-tier technologies. . . . . . . . . . . . 2-6
Other J2EE technologies . . . . . . . . . . . . 2-7
Preparing to deploy J2EE applications . . . . 2-8
Learning about J2EE . . . . . . . . . . . . . . . . 2-8
Chapter 5
Creating EJB 2.0 components with
JBuilder 5-1
Introducing EJB modules . . . . . . . . . . . . . 5-1
Creating an EJB 2.0 module . . . . . . . . . . 5-2
Creating a module with the EJB
Module wizard . . . . . . . . . . . . . . . 5-2
Creating an EJB module from
existing deployment descriptors . . . . . 5-4
Displaying the EJB Designer . . . . . . . . . . . . 5-5
Creating session beans . . . . . . . . . . . . . . . 5-7
Viewing a bean’s source code . . . . . . . . . . . 5-8
Modifying the bean . . . . . . . . . . . . . . . . . 5-9
Editing bean attributes . . . . . . . . . . . . . 5-9
Adding a new field . . . . . . . . . . . . . . . 5-9
Removing a field . . . . . . . . . . . . . . 5-10
Adding a new method . . . . . . . . . . . . 5-10
Removing a method . . . . . . . . . . . . 5-11
Creating message-driven beans . . . . . . . . . 5-12
Creating entity beans . . . . . . . . . . . . . . . 5-13
Creating entity beans from an
imported data source . . . . . . . . . . . . 5-13
Importing a data source . . . . . . . . . . 5-13
Modifying the imported data
source schema . . . . . . . . . . . . . . 5-15
Generating the entity bean classes
and interfaces . . . . . . . . . . . . . . . 5-17
Editing entity bean properties . . . . . . 5-17
Chapter 3
An introduction to EJB development 3-1
Why we need Enterprise JavaBeans . . . . . . . 3-1
Roles in the development of an EJB
application . . . . . . . . . . . . . . . . . . . . 3-2
Application roles . . . . . . . . . . . . . . . . 3-2
Infrastructure roles . . . . . . . . . . . . . . . 3-3
Deployment and operation roles . . . . . . . 3-4
EJB architecture . . . . . . . . . . . . . . . . . . 3-4
The EJB server . . . . . . . . . . . . . . . . . 3-5
The EJB container. . . . . . . . . . . . . . . . 3-5
How an enterprise bean works . . . . . . . . 3-6
Types of enterprise beans . . . . . . . . . . . . . 3-7
Session beans . . . . . . . . . . . . . . . . . . 3-7
Entity beans . . . . . . . . . . . . . . . . . . . 3-7
Message-driven beans . . . . . . . . . . . . . 3-7
Remote and local access . . . . . . . . . . . . . . 3-8
Developing enterprise beans . . . . . . . . . . . 3-8
i
Creating entity bean relationships . . . . . . 5-23
Using the relationship inspector to
specify a relationship . . . . . . . . . . . 5-24
Removing a relationship . . . . . . . . . . 5-27
Adding a finder method . . . . . . . . . . . . 5-28
Adding an ejbSelect() method . . . . . . . . 5-28
Adding a home business method. . . . . . . 5-29
Exporting a data source . . . . . . . . . . . . 5-30
Removing beans . . . . . . . . . . . . . . . . 5-30
How the EJB Designer names EJB files . . . . . 5-30
Fixing errors in your bean . . . . . . . . . . . . 5-31
Viewing the deployment descriptors . . . . . . 5-32
Displaying the Deployment Descriptor
editor . . . . . . . . . . . . . . . . . . . . . . 5-32
Setting IDE options for the EJB Designer . . . . 5-33
Taking the next step . . . . . . . . . . . . . . . . 5-33
Changing the build properties for a bean. . . 8-3
Compiling . . . . . . . . . . . . . . . . . . . . 8-4
The generated JAR file . . . . . . . . . . . . . . . 8-4
Editing deployment descriptors. . . . . . . . . . 8-5
Verifying descriptors . . . . . . . . . . . . . . 8-6
Chapter 9
Testing an enterprise bean 9-1
Creating a test client . . . . . . . . . . . . . . . . 9-1
Using the test client application . . . . . . . . . . 9-4
Testing your enterprise bean. . . . . . . . . . . . 9-5
Preparing to debug WebSphere
applications remotely . . . . . . . . . . . . . . . 9-8
Chapter 10
Deploying enterprise beans 10-1
Creating a deployment descriptor file . . . . . 10-2
The role of the deployment descriptor . . . . . 10-2
The types of information in the
deployment descriptor . . . . . . . . . . . 10-3
Structural information. . . . . . . . . . . 10-4
Application assembly information. . . . 10-5
Security . . . . . . . . . . . . . . . . . . . 10-5
Application server-specific
properties . . . . . . . . . . . . . . . . . 10-6
Creating an EAR file . . . . . . . . . . . . . . . 10-6
Deploying to an application server . . . . . . . 10-7
Deploying one or more JAR files . . . . . . 10-7
Deploying to non-Borland servers. . . . . . 10-8
Setting deployment options with
the Properties dialog box . . . . . . . . . . 10-8
Hot deploying to an application server . . . 10-9
Chapter 6
Creating EJB 1.x components with
JBuilder 6-1
Introducing EJB modules . . . . . . . . . . . . . 6-1
Creating an EJB 1.x module . . . . . . . . . . 6-2
Creating an EJB 1.x module with
the EJB Module wizard . . . . . . . . . . 6-2
Creating an EJB module from existing
enterprise beans. . . . . . . . . . . . . . . . 6-3
Creating an enterprise bean. . . . . . . . . . . . 6-4
Creating a session bean . . . . . . . . . . . . 6-6
Creating an entity bean . . . . . . . . . . . . 6-7
Adding the business logic to your bean . . . 6-9
Exposing business methods through
the remote interface . . . . . . . . . . . . . 6-11
Generating the bean class from a remote
interface . . . . . . . . . . . . . . . . . . . . . . 6-12
Creating the home and remote interfaces
for an existing bean . . . . . . . . . . . . . . . 6-14
Chapter 11
Using the Deployment Descriptor
editor
11-1
Chapter 7
Creating EJB 1.x entity beans
from an existing database table
7-1
Displaying the Deployment Descriptor
editor . . . . . . . . . . . . . . . . . . . . . . . 11-2
Viewing the deployment descriptor of
an enterprise bean. . . . . . . . . . . . . . . . 11-2
Changing bean information . . . . . . . . . . . 11-4
Enterprise bean information . . . . . . . . . . . 11-5
General panel . . . . . . . . . . . . . . . . . 11-5
Message Driven Bean panel . . . . . . . . . 11-8
Environment panel . . . . . . . . . . . . . . 11-9
EJB References panel . . . . . . . . . . . . .11-10
Resource references panel . . . . . . . . . .11-12
Security Role References panel . . . . . . .11-13
Creating entity beans with the EJB Entity
Bean Modeler . . . . . . . . . . . . . . . . . . . 7-1
Chapter 8
Compiling enterprise beans and
creating JAR files 8-1
Compiling the bean . . . . . . . . . . . . . . . . 8-1
Changing build properties for an EJB
module. . . . . . . . . . . . . . . . . . . . . 8-1
ii
Properties panel . . . . . . . . . . . . . . . 11-14
Security Identity panel. . . . . . . . . . . . 11-18
EJB Local References panel . . . . . . . . . 11-20
Resource Env Refs panel. . . . . . . . . . . 11-21
Server-specific Properties panel . . . . . . 11-22
Container transactions . . . . . . . . . . . . . 11-23
Setting container transaction policies . . . 11-23
WebLogic 6.x Transaction Isolation
panel . . . . . . . . . . . . . . . . . . . . . 11-25
Working with data sources . . . . . . . . . . . 11-26
Setting isolation levels . . . . . . . . . . . . 11-28
Setting data source properties . . . . . . . 11-28
Adding security roles and method
permissions . . . . . . . . . . . . . . . . . . . 11-30
Creating a security role . . . . . . . . . . . 11-31
Assigning method permissions . . . . . . . 11-31
Adding container-managed persistence
information for EJB 1.1 components . . . 11-34
Finders panel . . . . . . . . . . . . . . . . . 11-35
Specifying WebSphere 4.0 finders. . . . 11-37
Verifying descriptor information . . . . . . . . 11-38
Writing the session bean class . . . . . . . . . . 13-2
Implementing the SessionBean
interface. . . . . . . . . . . . . . . . . . . . 13-2
Writing the business methods . . . . . . . . 13-3
Adding one or more ejbCreate()
methods. . . . . . . . . . . . . . . . . . . . 13-3
How JBuilder can help you create a
session bean . . . . . . . . . . . . . . . . . 13-4
The life of a session bean . . . . . . . . . . . . . 13-6
Stateless beans . . . . . . . . . . . . . . . . . 13-6
Stateful beans . . . . . . . . . . . . . . . . . 13-6
The method-ready in transaction
state . . . . . . . . . . . . . . . . . . . . 13-8
A shopping cart session bean . . . . . . . . . 13-10
Examining the files of the cart example . . 13-10
The Cart session bean . . . . . . . . . . . . .13-11
Adding the required methods . . . . . 13-12
Adding the business methods . . . . . 13-13
Item class . . . . . . . . . . . . . . . . . . . 13-15
Exceptions . . . . . . . . . . . . . . . . . . 13-15
Required interfaces . . . . . . . . . . . . . 13-16
The home interface . . . . . . . . . . . 13-16
The remote interface . . . . . . . . . . . 13-17
The Cart deployment descriptor . . . . 13-18
Chapter 12
Using the DataExpress for
EJB components 12-1
The DataExpress EJB components . . . . . . . . 12-2
Components for the server . . . . . . . . . . 12-2
Components for the client . . . . . . . . . . . 12-2
Creating the entity beans . . . . . . . . . . . . . 12-2
Creating the server-side session bean . . . . . . 12-3
Adding provider and resolver
components to the session bean. . . . . . . 12-3
Writing the setSessionContext() method. . . 12-4
Adding an EJB reference to the
deployment descriptor . . . . . . . . . . 12-5
Adding the providing and resolving
methods . . . . . . . . . . . . . . . . . . . . 12-5
Calling the finder method . . . . . . . . . . . 12-6
Building the client side . . . . . . . . . . . . . . 12-7
Handling relationships . . . . . . . . . . . . . . 12-9
The sample project . . . . . . . . . . . . . . . . . 12-9
Chapter 14
Developing entity beans 14-1
Persistence and entity beans . . . . . . . . . . . 14-1
Bean-managed persistence . . . . . . . . . . 14-2
Container-managed persistence . . . . . . . 14-2
Primary keys in entity beans. . . . . . . . . . . 14-2
Writing the entity bean class . . . . . . . . . . . 14-3
Implementing the EntityBean interface . . . 14-4
Declaring and implementing the
entity bean methods . . . . . . . . . . . . . 14-5
Creating create methods . . . . . . . . . 14-5
Creating finder methods . . . . . . . . . 14-7
Writing the business methods . . . . . . 14-7
The life of an entity bean . . . . . . . . . . . . . 14-8
The nonexistent state . . . . . . . . . . . . . 14-8
The pooled state . . . . . . . . . . . . . . . . 14-8
The ready state. . . . . . . . . . . . . . . . . 14-9
Returning to the pooled state . . . . . . . . 14-9
A bank entity bean example . . . . . . . . . . 14-10
The entity bean home interface . . . . . . 14-10
The entity bean remote interface. . . . . . .14-11
An entity bean with container-
managed persistence . . . . . . . . . . . .14-11
Chapter 13
Developing session beans 13-1
Types of session beans. . . . . . . . . . . . . . . 13-1
Stateful session beans . . . . . . . . . . . . . 13-1
Stateless session bean . . . . . . . . . . . . . 13-2
iii
Plik z chomika:
X-files
Inne pliki z tego folderu:
Wireless Java Developing with J2ME 2nd 2003.chm
(2615 KB)
Wireless J2ME Platform Programming , 2002.pdf
(2614 KB)
using uml for modeling a distributed java application 1997.pdf
(707 KB)
Using Java 2 Standard Ed 2001.chm
(6449 KB)
Using Enterprise JavaBeans 2.0 2002.chm
(1098 KB)
Inne foldery tego chomika:
130 linux and unix ebooks
132 C and C++ ebooks
156 database ebooks
237.For.Dummies.ebooks.Wiley.Publishing
Architecture e-books
Zgłoś jeśli
naruszono regulamin