Specifying a BMP Entity Bean

Following the pattern of Session beans, specifying an Entity bean involves defining the local-home and the local interface:

  • The local-home interface extends javax.ejb.EJB LocalHome.

  • The local interface extends javax.ejb.EJBLocalObject.

A discussion on each of these interfaces follows.

NOTE

Although Entity beans usually use the local interface, there is no reason why the remote interface cannot be used instead of, or as well as, the local interface. In the following discussion, EJBHome and EJBLocalHome and EJBOject and EJBLocalObject can be considered synonymous; however all methods in the remote interfaces must throw RemoteException (as discussed on Day 5, “Session EJBs”).

Local-Home Interface

Listing 6.1 shows the ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition 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.