Chapter 4. Developing Your First Enterprise Beans

One of the most important features of EJB is that enterprise beans have the ability to work with containers from different vendors. However, that doesn’t mean that selecting a server and installing your enterprise beans on that server are trivial processes.

Choosing and Setting Up an EJB Server

The EJB server you choose should provide a utility for deploying enterprise beans. It doesn’t matter whether the utility is command-line oriented or graphical, as long as it does the job. The deployment utility should allow you to work with prepackaged enterprise beans, i.e., enterprise beans that have already been developed and archived in a JAR file. Finally, the EJB server must support an SQL-standard relational database that is accessible using JDBC. For the database, you should have privileges sufficient for creating and modifying a few simple tables in addition to normal read, update, and delete capabilities. If you have chosen an EJB server that does not support a SQL-standard relational database, you may need to modify the examples to work with the product you are using.

This book does not say very much about how to install and deploy enterprise beans. That task is largely server-dependent. We’ll provide some general ideas about how to organize JAR files and create deployment descriptors, but for a complete description of the deployment process, you’ll have to refer to your vendor’s documentation.

Setting Up Your Java IDE

To get the most from this chapter, it helps to have an IDE that has a debugger and allows you to add Java files to its environment. Several Java IDEs—such as BEA’s Weblogic Workshop, IBM’s Eclipse, Borland’s JBuilder, and Sun’s Forte—fulfill this requirement. Some EJB products, such as IBM’s WebSphere and BEA’s Weblogic, are tightly coupled with an IDE that makes life a lot easier when it comes to writing, deploying, and debugging your applications.

Once you have an IDE set up, you need to include the Enterprise JavaBeans and other J2EE packages which will be provided by your application server vendor—usually in a single JAR file (e.g., j2ee.jar).

Get Enterprise JavaBeans, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.