Before You Begin

This book describes how to build Enterprise JavaBeanstrademark components (enterprise beans) using the Fortetrademark for Javatrademark, Enterprise Edition, IDE.

Enterprise beans come in several varieties. A session bean can be stateful or stateless, and can manage its own transactions or have them managed by the EJBtrademark container. An entity bean can manage its own persistence or let the container manage its relationship with the underlying database. You can use the Forte for Java IDE to build those enterprise beans as well as message-driven beans and sets of entity beans whose relationships are managed by the EJB container. Flexible support is available to the developer in building all of these types of enterprise beans. The IDE streamlines the task of coding and helps ensure that the results are consistent with the Javatrademark 2 Platform, Enterprise Edition Blueprints (the J2EEtrademark Blueprints).

Another book in this series, Building J2EE Applications With Forte for Java, suggests designs for industrial-strength applications that use enterprise beans and other J2EE components. It offers various application scenarios, and explains how to assemble finished enterprise beans and other components into modules, how to deploy them in applications, and how to run those applications. This book, Building Enterprise JavaBeans Components, concentrates on the design and creation of enterprise beans, and on basic issues of assembly, deployment, and testing. If you are responsible for providing enterprise beans, assembling them into applications, and deploying them on application servers, you should refer to both books.

You can use the Forte for Java IDE to create the examples in this book on the systems listed in the Release Notes. Find the Release Notes on the following website:

http://forte.sun.com/ffj/documentation/index.html

Screen shots vary slightly from one platform to another. You should have no trouble translating the slight differences to your platform. Although almost all procedures use the Forte for Java user interface, you might occasionally be instructed to enter a command at the command line. Here too, there are slight differences from one platform to another. For example, a Microsoft Windows command might look like this:

c:\>cd MyWorkDir\MyPackage

To translate for UNIX® or Linux environments, simply change the prompt and use forward slashes:

% cd MyWorkDir/MyPackage


Before You Read This Book

If you want to use the Forte for Java IDE to build enterprise beans, you will benefit from reading this document. Before starting it, you should be familiar with the following subjects:

  • The Java programming language
  • The EJB component model
  • The JDBCtrademark API and JDBC-enabled driver syntax
  • Relational database concepts (such as tables, columns, and keys)
  • How to use the chosen database
  • The Java Message Service (JMS) API
  • XML syntax

To develop enterprise beans, you need to know J2EE concepts and generally to understand enterprise beans. At some stages of bean development, you also need to know about specific application servers. Whenever further details are needed, refer to the following list of resources:



Note - Sun is not responsible for the availability of third-party web sites mentioned in this document and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. Sun will not be responsible or liable for any damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods, or services available on or through any such sites or resources.




How This Book Is Organized

Chapter 1 introduces J2EE and Enterprise JavaBeans concepts, and gives an overview of the Forte for Java IDE's support for creating enterprise beans and assembling them into EJB modules.

Chapter 2 discusses design and programming issues for those who use the IDE to build enterprise beans and assemble EJB modules.

Chapter 3 tells how to use the IDE to create stateless or stateful session beans that manage their own transactions or delegate their transaction management to the EJB container.

Chapter 4 tells how to use the IDE to create single entity beans with container-managed persistence (CMP entity beans).

Chapter 5 tells how to use the IDE to create sets of CMP entity beans with their relationships automatically included.

Chapter 6 tells how to use the IDE to create entity beans with bean-managed persistence (BMP entity beans).

Chapter 7 tells how to use the IDE to create message-driven beans.

Chapter 8 shows how to prepare a bean for deployment by specifying properties on the bean and its EJB module.

Chapter 9 explains how to use the IDE's testing feature to test enterprise beans.

Appendix A contains instructions for working with enterprise beans in the IDE.

Appendix B provides tips on updating and converting EJB 1.1 enterprise beans so that they are maintainable and executable in the current version of the IDE.


Typographic Conventions

Typeface

Meaning

Examples

AaBbCc123

The names of commands, files, and directories; on-screen computer output

Edit your.login file.

Use ls -a to list all files.

% You have mail.

AaBbCc123

What you type, when contrasted with on-screen computer output

% su

Password:

AaBbCc123

Book titles, new words or terms, words to be emphasized

Read Chapter 6 in the User's Guide.

These are called class options.

You must be superuser to do this.

AaBbCc123

Command-line variable; replace with a real name or value

To delete a file, type rm filename.



Related Documentation

Forte for Java documentation includes books delivered in Acrobat Reader (PDF) format, online help, readme files of example applications, and Javadoctrademark documentation.

Documentation Available Online

The documents in this section are available from the Forte for Java portal and the docs.sun.comSM web site.

The documentation link of the Forte for Java Developer Resources portal is at http://forte.sun.com/ffj/documentation/. The docs.sun.com web site is at http://docs.sun.com.

  • Release Notes (HTML format)
Available for each Forte for Java edition. Describe last-minute release changes and provide technical notes.
  • Forte for Java Installation Guide (PDF format)
    Community Edition part no. 816-4062-10, Enterprise Edition part no. 816-4063-10
Available for each Forte for Java edition. Describes how to install the Forte for Java product on each supported platform and includes other pertinent information such as system requirements, upgrade instructions, web server and application server installation instructions, command-line switches, installed subdirectories, Javadoc setup, database integration, and information on how to use the Update Center.
  • The Forte for Java Programming Series (PDF format)
This series provides in-depth information on how to use various Forte for Java features to develop well-formed J2EE applications.
    • Building Web Components - part no. 816-4337-10
Describes how to build a web application as a J2EE web module using JSP pages, servlets, tag libraries, and supporting classes and files.
    • Building J2EE Applications With Forte for Java - part no. 816-4061-10
Describes how to assemble EJB modules and web modules into a J2EE application, and how to deploy and run a J2EE application.
    • Building Enterprise JavaBeans Components - part no. 816-4060-10 (this book)
    • Building Web Services - part no. 816-4059-10
Describes how to use the Forte for Java IDE to build web services, to make web services available to others through a UDDI registry, and to generate web service clients from a local web service or a UDDI registry.
    • Using Java DataBase Connectivity - part no. 816-4685-10
Describes how to use the JDBC productivity enhancement tools of the Forte for Java IDE, including how to use them to create a JDBC application.
  • Forte for Java tutorials (PDF format)
    • Forte for Java, Community Edition Tutorial - part no. 816-4058-10
Provides step-by-step instructions for building a simple J2EE web application using Forte for Java, Community Edition tools.
    • Forte for Java, Enterprise Edition Tutorial - part no. 816-4057-10
Provides step-by-step instructions for building an application using EJB components and Web Services technology.
You can also find the completed tutorial applications at http://forte.sun.com/ffj/documentation/
tutorialsandexamples.html

The docs.sun.com web site (http://docs.sun.com) enables you to read, print, and buy Sun Microsystems manuals through the Internet. If you cannot find a manual, see the documentation index installed with the product on your local system or network.

Online Help

Online help is available inside the Forte for Java development environment. You can access help by pressing the help key (Help in a Solaris environment, F1 on Microsoft Windows and Linux), or by choosing Help right arrow Contents. Either action displays a list of help topics and a search facility.

Examples

You can download several examples that illustrate a particular Forte for Java feature, as well as the source files for the tutorial applications from the Developer Resources portal, at:

http://forte.sun.com/ffj/documentation/tutorialsandexamples.html

Javadoc Documentation

Javadoc documentation is available within the IDE for many Forte for Java modules. Refer to the release notes for instructions on installing this documentation. When you start the IDE, you can access this Javadoc documentation within the Javadoc pane of the Explorer.


Sun Welcomes Your Comments

Sun is interested in improving its documentation and welcomes your comments and suggestions. You can email your comments to Sun at:

docfeedback@sun.com

Please include the part number (816-4060-10) of this document in the subject line of your email.