Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Getting started with Enterprise JavaBeans technology

Joe Sam is a contributing developerWorks author.

Summary:  This tutorial introduces the basics of EJB programming and the Java 2 Enterprise Edition environment. Joe Sam Shirah takes you through stateless and stateful session beans, entity beans using both bean-managed and container-managed persistence, and message-driven beans. The tutorial also provides background material for transaction handling and the Java Message Service, and includes complete code examples for functional, Web-based applications.

Date:  01 Apr 2003
Level:  Introductory PDF:  A4 and Letter (1051 KB | 104 pages)Get Adobe® Reader®

Activity:  26097 views
Comments:  

About this tutorial

What is this tutorial about?

The goal of this tutorial is to give you a practical introduction to the basics of Enterprise JavaBeans (EJB) programming and development. EJB components are at the heart of the Java 2 Platform, Enterprise Edition (J2EE) framework, which is the Java language's extremely successful solution to the needs of enterprise applications. EJB technology provides a standard server-side component model for J2EE application servers, or containers.

This tutorial covers stateless and stateful session beans, entity beans using bean-managed persistence (BMP) and container-managed persistence (CMP), and message-driven beans. Along the way, the tutorial also touches on JDBC, transaction handling with the Java Transaction API (JTA), and the Java Message Service (JMS), and uses these technologies in the sample code. Complete examples based on functional Web applications are discussed throughout the tutorial and a link for the full download of the code is provided in Resources.

After working through the tutorial, you should:

  • Understand EJB technology concepts and terminology
  • Understand how EJB components work cooperatively with J2EE containers
  • Understand the process and requirements for creating EJB components
  • Have a solid foundation for developing your own Enterprise JavaBean and J2EE applications

Should I take this tutorial?

While the tutorial is an introduction to development with EJB technology, this is not entry-level material; you should be an intermediate or higher level Java programmer with some understanding of JDBC to get the most out of it and fully understand the code examples. You will also need to know how servlets and JavaServer Pages (JSP) technology work to understand the client code. However, you can read the material purely to gain an overview of what EJB technology is about and how J2EE and EJB components work together.

The tutorial covers EJB technology as of the J2EE 1.3.1 SDK and the EJB 2.0 specification. At the time of writing, a beta release of J2EE 1.4 and a draft of the 2.1 EJB specification had just been released. Appendix D: What's new in the EJB 2.1 specification? briefly reviews the new capabilities.

In short, if you are a reasonably experienced Java programmer interested in increasing your skill set and understanding the Java platform's approach to enterprise applications, this tutorial is for you.

If you intend to create your own J2EE and EJB applications or want to understand the flow and rationale for the example applications, I suggest going through the tutorial in the following order:

The Resources present a list of tutorials, articles, and other references that expand upon the material presented here.


Code samples and installation requirements

To compile and run the example code, and to get hands-on experience in creating EJB components and J2EE applications, you will need both the J2SE and J2EE SDKs, as well as a source code editor or IDE.

The examples were tested using J2SE 1.4.1 and the J2EE 1.3.1 SDK Reference Implementation (J2EE RI) on Windows NT 4.0, Service Pack 6a. The applications have also been proven to run properly, with the appropriate deployment, under JBoss 3.0.4 on both Windows NT and SuSe Linux.

You should be aware that the example programs focus on EJB development for the relevant section, and have not been optimized for production use. Any introductory and most intermediate material suffers this limitation due to the need to zero in on the target topic without the litter of numerous real-world considerations. That's certainly true here, due to the breadth of the areas covered, and many best practices had to be left undone or unmentioned to keep the tutorial understandable and to a reasonable size. The upshot is that you will learn enough to get started with J2EE and EJB technology, but you should look to the Resources and other references before embarking on production-quality applications. In particular, if you want to be more than just a "follow the IDE wizard" EJB developer, you will find yourself frequently reviewing the EJB specification.

Even so, you should read through the example explanations whether or not you intend to review the code or run the applications. These discussions mention specific techniques, and often expand or augment the relevant tutorial section.

The classes, Enterprise Archive (EAR) files, and source code for the examples used in the tutorial are available separately in gsejbExamples.jar. The JAR contains a main directory named gsejbExamples, with subdirectories named Alice, MetricCvt, Survey1, Survey2, Survey3, and SurveyResults, each of which corresponds to an example application. You can also see the applications in action before, or instead of, deploying them yourself at conceptGO's Community page.

1 of 10 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Java technology
ArticleID=131598
TutorialTitle=Getting started with Enterprise JavaBeans technology
publish-date=04012003
author1-email=
author1-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Special offers