O'Reilly logo

Special Edition Using Java™ 2 Enterprise Edition by Mark Wutka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Session Bean That Does Some Work

The main purpose of the HelloWorldSession example was to get you familiar with the overall structure of a session bean. Writing three different Java files for a single component seems overwhelming at first, but after you're used to it, it doesn't seem like such a big deal.

Now that you're familiar with the structure of a session bean, you can write a bean that does some work. Specifically, you can write a bean that retrieves data from a database. For this example, assume that you have an SQL table containing product codes and prices, created using the following SQL statement:

create table price
    (product_code varchar(10) not null primary key,
     price decimal(10,2) not null)

The Pricing session bean gives ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required