Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

A beginner's guide to Enterprise JavaBeans

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

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone

Page 2 of 7

Client-server systems are now commonly composed of various numbers of tiers. The standard old mainframe or timesharing system, where the user interface runs on the same computer as the database and business applications, is known as single tier. Such systems are relatively easy to manage, and data consistency is simple because data is stored in only one place. Unfortunately, single-tier systems have limited scalability and are prone to availability hazards (if one computer's down, your whole business goes down), particularly if communication is involved.

The first client/server systems were two-tier, wherein the user interface ran on the client, and the database lived on the server. Such systems are still common. One garden-variety type of two-tier server performs most of the business logic on the client, updating shared data by sending streams of SQL to the server. This is a flexible solution, since the client/server conversation occurs at the level of the server's database language. In such a system, a properly designed client can be modified to reflect new business rules and conditions without modifying the server, as long as the server has access to the database schema (tables, views, and so forth) needed to perform the transactions. The server in such a two-tier system is called a database server, as shown below.

Figure 1. A database server

Database servers have some liabilities, though. Often the SQL for a particular business function (for example, adding an item to an order) is identical, with the exception of the data being updated or inserted, from call to call. A database server ends up parsing and reparsing nearly identical SQL for each business function. For example, all SQL statements for adding an item to an order are likely to be very similar, as are the SQL statements for finding a customer in the database. The time this parsing takes would be better spent actually processing data. (There are remedies to this problem, including SQL parse caches and stored procedures.) Another problem that arises is versioning the clients and the database at the same time: all machines must shut down for upgrades, and clients or servers that fall behind in their software version typically aren't usable until they're upgraded.

Application servers
An application server architecture (see the next image) is a popular alternative to a database server architecture because it solves some of the problems database servers have.

Figure 2. An application server

A database server environment usually executes business methods on the client, and uses the server mostly for persistence and enforcing data integrity. In an application server, business methods run on the server, and the client requests that the server execute these methods. In this scenario, the client and server typically will use a protocol that represents a conversation at the level of business transactions, instead of at the level of tables and rows. Such application servers often perform better than their database counterparts, but they still suffer from versioning problems.

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comments (5)
Login
Forgot your account info?

EJBs overviewBy Anonymous on October 17, 2009, 7:19 amProvided a basic understanding of EJB-s. Details of implementation were missing, though I believe that is out of scope for the article.

Reply | Read entire comment

This is an exelent materialBy M.Nadeem Arif on July 16, 2009, 5:48 amThis is an exelent material for understanding of EJB and its related concepts

Reply | Read entire comment

Tutorial is ExcellentBy Anonymous on May 31, 2009, 6:24 amThis tutorial is very simple and best. It is easily understandable for any beginners.

Reply | Read entire comment

The tutorial helped me understand a lot of conceptsBy Anonymous on May 19, 2009, 3:41 amI had an application written using EJB 2.0 and it seemed really hard to understand before i went through tutorial :)

Reply | Read entire comment

EJBs overviewBy Anonymous on May 11, 2009, 11:54 amExcellent tutorial for begginners.The concepts have been explained very well.Written in a very simplified manner.

Reply | Read entire comment

View all comments

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
  • 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