Client's View

You've now seen how to specify, implement, and deploy BMP Entity beans, you will now look at how they are used. As you can probably imagine, the steps to obtain a reference to an Entity bean are similar to that for a Session bean:

Look up the home interface for the Entity bean from JNDI.
Use the relevant home.create() method to create a new entity instance.
If the primary key is known, use home.findByPrimaryKey() to locate an existing entity instance, or some other home.findXxx() finder method to obtain a Collection of matching entities.
Invoke the business methods on the local proxy returned from the finder and create methods defined in the local interface of the bean.

The javax.ejb.EJBLocalObject interface also defines ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition now with O’Reilly online learning.

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