7.7 A SHOPPING CART—SIMPLIFIED EXAMPLE

Consider a Bean shopping cart which lists out a set of beans (of the eating variety!) for the user to order items and store in a shopping cart. Though production-ready implementations of shopping cart handles complex scenarios, lets us abstract into a simple set of beans to demonstrate a local interface and how business logic is defined and applied.

 

X2BizLocal.java—The EJB business interface

 

Fig. 7.4 X2BizLocal.java—The EJB business interface

 

The business interface is listed out in the code shown in Figure 7.4. The interfaces are implemented in the Bean class.

 

 

Fig. 7.5 X2Biz.java—The EJB business interface logic

 

A few Java annotations ...

Get Web Technology: Theory and Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.