O'Reilly logo

J2EE™ Tutorial, The by Beth Stearns, Monica Pawlan, Eric Jendrock, Kim Haase, Dale Green, Stephanie Bodoff

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

The CartEJB Example

The CartEJB session bean represents a shopping cart in an online bookstore. The bean’s client may add a book to the cart, remove a book, or retrieve the cart’s contents. To construct CartEJB, you need the following code:

  • Session bean class (CartBean)

  • Home interface (CartHome)

  • Remote interface (Cart)

All session beans require a session bean class. All enterprise beans that permit remote access must have a home and remote interface. To meet the needs of a specific application, an enterprise bean may also need some helper classes. The CartEJB session bean uses two helper classes, BookException and IdVerifier, which are discussed in the section Helper Classes (page 76).

The source code for this example is in the j2eetutorial/examples/src/ejb/cart ...

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