Client view of an entity bean

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

Looking up the bean home

Figure 3-22 shows the finding of a home interface. Because we use a local interface, we are not required to do a PortableRemoteObject.narrow on the object that is returned from the lookup method. Remember, the JNDI name is specified at deployment time, but not in the deployment descriptor.

Figure 3-22. Client local lookup of home interface
 InitialContext ctx = new InitialContext(); Object objHome = ctx.lookup("java:comp/env/ejb/CustomerLocalHome"); CustomerLocalHome home = (CustomerLocalHome) ...

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.