Accessing Other Entity Beans

The implementation of ejbLoad shown previously in Listing 6.7 loaded the primary key value for its associated item but it didn’t load the item. This is a good approach as long as a component interface reference to the item can be obtained when it’s needed. Just like any other client, the way an entity bean gets a reference to another entity is by calling a finder method on that entity’s home interface. This means that the first step is to get a reference to the home interface. An EJB gets a reference to another EJB’s home using an EJB reference defined in its environment. The following fragment from the auction entity’s ejb-jar.xml deployment descriptor shows how you define an EJB reference to another bean’s local ...

Get Special Edition Using Enterprise JavaBeans™ 2.0 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.