Client view of a session bean

This section describes more of the client view for the Banking and Reports EJBs that extends the basic client example in “EJB client view” on page 56. The examples are based on remote home and component interfaces.

We highlight where the client view changes depending on whether the bean is stateful or stateless.

Looking up the bean home

Figure 5-25 shows the finding of a home interface of a session bean.

Figure 5-25. Client local lookup of home interface for a remote session bean
InitialContext ctx = new InitialContext();
Object objHome = ctx.lookup("itso/BankingJNDIName");
BankingHome bankingHome = (BankingHome)javax.rmi.PortableRemoteObject.narrow
      (objHome, BankingHome.class );

Because we use a remote interface, ...

Get EJB 2.0 Development with WebSphere Studio Application Developer 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.