6.5. Session Facade Pattern

Consider what we need to do to integrate our Customer EJB into the Music Collection virtual shopping application (return to Figure 6-2 on page 205). When a user accesses the “login” web page, the JSP client asks for a login name and password. The client must determine if the user name is valid and if the password matches the given user name. We accomplish this multiple-step process by invoking method findByCustomerName(), which returns a collection. The client must then verify that only one Customer instance is in the collection. It then must call getPassword() and check to see if the entity bean's password matches the one provided by the user.

For a JSP client or stand-alone Java client to accomplish this task, we ...

Get Enterprise JavaBeans™ Component Architecture: Designing and Coding Enterprise Applications now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.