Newsletter sign-up
View all newsletters

Sign up for our Enterprise Java Newsletter

Enterprise Java

Write a session EJB

Find out how EJB frees developers from the complexity of middleware development by providing complete infrastructure support

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Enterprise JavaBeans (EJB) 1.0 is the exciting new enterprise component model for Java. EJB is exciting because it brings modern, powerful capabilities to enterprise middleware written in Java.

No longer do you need to write every bit of infrastructure for the middleware tier of a Java application or (if you're lucky) modify previous code for this purpose. Instead, EJB handles that process for you -- all you have to do is write the actual business logic you are trying to implement.

In this article, we'll see how EJB is able to work such miracles. We'll begin with a brief background on the component software model, then we'll zero in on EJB itself. Once you have your bearings, we'll revisit the Forum application of columns past (see Resources for links to all previous Step by Step columns) and port its middleware tier to an enterprise bean.

The component software model

The component software model is based on the idea of creating reusable components that plug into containers. This model is rapidly gaining popularity in the software development community because it addresses several important development goals: reuse, high-level development focus, development automation via tools, and simplified deployment. JavaBeans, EJB, and ActiveX/COM are examples of component models.

Component models come in two basic flavors -- client-side and enterprise. Client-side component models such as JavaBeans are specialized to handle presentation and user interface issues. Enterprise component models such as EJB are concerned with providing infrastructure for transactions-oriented middleware components.

Using one of the component model specs, component developers write component "building blocks" that implement business logic. Application developers hook up these pre-built components into finished applications, which may themselves be components.

This building block approach facilitates off-the-shelf reuse of code packaged as components. Containers provide services so that component developers can write high-level business logic instead of infrastructure such as networking code. Development automation is achieved through development environments that allow the application developer to assemble components, usually using a visual metaphor.

The enterprise component model
Enterprise component models such as EJB and ActiveX/MTS bring the component model of development to middleware. Enterprise middleware development is notoriously complicated -- it involves not only business logic, but concurrency and scaling issues, as well as gluing together incompatible systems on incompatible platforms.

Enterprise component models solve middleware development complexity by factoring all of this infrastructure into containers and servers. This allows the middleware developer to focus on writing the business logic, without having to worry about synchronization, scalability, transaction integrity, networking, distributed object frameworks, and other related matters.

In other words, the enterprise component model offers developers the following advantages:

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comment
Login
Forgot your account info?
Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources
  • Download the complete source as a zip file http://www.javaworld.com/jw-07-1998/step/jw-07-step.zip
  • Download the complete source as a gzipped tar file http://www.javaworld.com/jw-07-1998/step/jw-07-step.tar.gz
  • Information about EJB
  • EJB development libraries and documentation
  • Previous Step by Step articles