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 O’Reilly online learning.

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