O'Reilly logo

J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software by Art Taylor

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 Session Bean Code

The session bean declared for the shopping cart EJB demonstrates object-oriented code reuse by simply extending the ShoppingCartBean class developed for the first example. Since the EJB specification allows EJBs to be part of an inheritance hierarchy (even though they themselves cannot be extended), this use of inheritance is allowed.

The ejbCreate method shown next has been overloaded to accept an argument for the userID. This integer value is passed to the method and used to set the userID for the shopping cart. All other functionality provided by the session bean is in fact provided by its superclass, the ShoppingCartBean. Note that any methods exposed in the session bean's remote interface must be declared public (which ...

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