EJB.10.2 Inheritance Relationship


Figure EJB.10-1 shows an example of the inheritance relationship.

Figure EJB.10-1. Example of the Inheritance Relationship Between the Interfaces and Classes

EJB.10.2.1 What the Entity Bean Provider Is Responsible For

Wombat Inc. is responsible for providing the following:

  • Define the entity bean's remote interface ( Account ). The remote interface defines the business methods callable by a client. The remote interface must extend the javax.ejb.EJBObject interface, and follow the standard rules for a RMI-IIOP remote interface. The remote interface must be defined as public.

  • Write the business logic in the entity bean class ( AccountBean ). The entity bean class may, but is not required to, implement the entity bean's remote interface ( Account ). The entity bean must implement the methods of the javax.ejb.EntityBean interface, the ejbCreate(...) and ejbPostCreate(...) methods invoked at an entity object creation, and the finder methods (the finders should not have to be implemented if the entity bean uses container-managed persistence).

  • Define a home interface ( AccountHome ) for the entity bean. The home interface defines the entity bean's specific create and finder methods. The home interface must be defined as public, extend the javax.ejb.EJBHome interface, and follow the standard rules for RMI-IIOP remote interfaces.

  • Define a deployment descriptor that specifies any declarative information that the entity bean provider wishes to pass with the entity bean to the next stage of the development/deployment workflow.

EJB.10.2.2 Classes Supplied by Container Provider

The following classes are supplied by the container provider, Acme Corporation:

  • The AcmeHome class provides the Acme implementation of the javax.ejb.EJBHome methods.

  • The AcmeRemote class provides the Acme implementation of the javax.ejb.EJBObject methods.

  • The AcmeBean class provides additional state and methods to allow Acme's container to manage its entity bean instances. For example, if Acme's container uses an LRU algorithm, then AcmeBean may include the clock count and methods to use it.

  • The AcmeMetaData class provides the Acme implementation of the javax.ejb.EJBMetaData methods .

EJB.10.2.3 What the Container Provider Is Responsible For

The tools provided by Acme Corporation are responsible for the following:

  • Generate the entity EJBOBject class ( AcmeRemoteAccount ) that implements the entity bean's remote interface. The tools also generate the classes that implement the communication protocol specific artifacts for the remote interface.

  • Generate the implementation of the entity bean class suitable for the Acme container ( AcmeAccountBean ). AcmeAccountBean includes the business logic from the AccountBean class mixed with the services defined in the AcmeBean class. Acme tools can use inheritance, delegation, and code generation to achieve mix-in of the two classes.

  • Generate the entity EJBHome class ( AcmeAccountHome ) for the entity bean that implements the entity bean's home interface ( AccountHome ). The tools also generate the classes that implement the communication protocol specific artifacts for the home interface.

  • Generate a class ( AcmeAccountMetaData ) that implements the javax.ejb.EJBMetaData interface for the Account Bean .

The above classes and tools are container-specific (i.e., they reflect the way Acme Corporation implemented them). Other container providers may use different mechanisms to produce their runtime classes, and the generated classes most likely will be different from those generated by Acme's tools.



Java 2 Platform, Enterprise Edition. Platform and Component Specifications
Java 2 Platform, Enterprise Edition: Platform and Component Specifications
ISBN: 0201704560
EAN: 2147483647
Year: 2000
Pages: 399

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net