Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

A beginner's guide to Enterprise JavaBeans

An introductory overview of the Java server-side application component standard

  • Print
  • Feedback
Enterprise JavaBeans (EJB) has generated a great deal of excitement since the March 1998 announcement of the Enterprise JavaBeans Specification Version 1.0. Companies such as Oracle, Borland, Tandem, Symantec, Sybase, and Visigenic, among many others, have announced and/or delivered products that adhere to the EJB specification. This month, we'll take a high-level look at what exactly Enterprise JavaBeans is. We'll go over how EJB differs from the original JavaBeans component model, and discuss why EJB has generated such an enormous amount of interest.

But first, an advisory: we won't be looking at source code or how-to topics this month. This article isn't a tutorial; rather it's an architectural overview. EJB covers a lot of territory, and without first understanding the basic concepts involved, code snippets and programming tricks are meaningless. If there's interest on the part of JavaWorld's readers, future articles may cover the specifics of using the Enterprise JavaBeans API to create your own Enterprise JavaBeans.

In order to understand why EJB is so attractive to developers, we need some historical background. First, we'll look at the history of client/server systems, and at the current state of affairs. Then, we'll discuss the various parts of an EJB system: EJB components -- which live on an EJB container running inside an EJB server -- and EJB objects, which the client uses as a kind of "remote control" of EJB components. We'll go over the two types of EJBs: session and entity objects. You'll also read about home and remote interfaces, which create EJB instances and provide access to the EJB's business methods, respectively. By the end of the article, you'll have an idea of how extensible servers can be built using Enterprise JavaBeans. But first, a look back in time.

Client/server history

Ancient history
In the beginning, there was the mainframe computer. And it was good. (Or as good as it got, anyway.) The state of the art in information processing through the 1960s consisted primarily of big, expensive machines used by large organizations to support their daily business operations. Minicomputers and timesharing in the 1970s increased the accessibility of computing power, but information and processing were still centralized on individual machines. The first personal computers in the 1980s quickly cluttered the corporate landscape with thousands of tiny islands of information, all tirelessly churning out reports of variable quality, losing critical data when they crashed, and quickly becoming inconsistent with each other.

Client/server to the rescue
The client/server architecture is one of the most common solutions to the conundrum of how to handle the need for both centralized data control and widespread data accessibility. In client/server systems, information is kept relatively centralized (or is partitioned and/or replicated among distributed servers), which facilitates control and consistency of data, while still providing access to the data users need.

  • Print
  • Feedback

Resources
  • You can find out more about Enterprise JavaBeans in JavaWorld in Bryan Morgan's article "Enterprise JavaBeansComing soon to a server near you." Bryan discusses EJB distributed transactions and CORBA compatibility http://www.javaworld.com/jw-06-1998/jw-06-distributed.html
  • Enterprise JavaBeans was a hot topic at this year's JavaOne. Rich Kadel's JavaOne Today technical coverage of the topic can be found at http://www.javaworld.com/javaone98/j1-98-ejb.html
  • Try your hand at writing your own EJB by following Michael Shoffner's Step by Step column "Write a session EJB" featured in JavaWorld http://www.javaworld.com/jw-07-1998/jw-07-step.html
  • More introductory information about EJB, including a great description of the lifecycle of an EJB, appears in the NC World article "Enterprise JavaBeansIndustrial-strength Java" http://www.ncworldmag.com/ncworld/ncw-01-1998/ncw-01-ejbeans.html
  • Another NC World article covering EJB is "Bean BasicsEnterprise JavaBeans Fundamentals" http://www.ncworldmag.com/ncworld/ncw-04-1998/ncw-04-ejbprog2.html
  • Sun's home page for Enterprise JavaBeans technology can be found at http://java.sun.com/products/ejb/index.html
  • You can download the EJB Specification, all 181 pages of it, at http://java.sun.com/products/ejb/docs.html
  • Java Report Online has a great article by Richard Monson-Haefel that goes into more detail about how to use the EJB API. This article goes into the concepts of developer "roles" that are laid out by the EJB Specification, and provides a good backgrounder for anyone considering tackling the spec itself http://www.sigs.com/jro/features/9803/oldlayout/haefel.html
  • Read Mark Johnson's previous JavaBeans columns http://www.javaworld.com/topicalindex/jw-ti-beans.html