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

A "Hello World" Session Bean

The structure of Enterprise JavaBeans can be a little awkward to work with at first, but after you get a feel for the structure, EJBs aren't too bad. Fortunately, you can become familiar with the basic EJB structure without worrying about database connections or transactions. To do this, start with a good old-fashioned "Hello World" bean.

When you design EJB applications, you might wonder whether you should start with the bean and then create the interfaces, or start with the interfaces and then create the bean. Your best bet here is to start with the interfaces. If you can't describe how a client is going to use the bean, you aren't ready to write it.

Creating the Remote Interface

Listing 6.1 shows the HelloWorldSession ...

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