EJB inheritance

The EJB deployment descriptor editor can help you define inheritance relationships between enterprise beans.

You can use the tools to define two forms of inheritance:

In standard class inheritance, the home interface, remote interface, or enterprise bean class inherits properties and methods from base classes that are not themselves enterprise bean classes or interfaces. You would specify the bean superclass using the superclass field of the enterprise bean wizard.

In EJB inheritance, by comparison, an enterprise bean inherits properties (such as CMP fields and relationship roles), methods, and method-level assembly descriptor attributes from another enterprise bean that resides in the same EJB module. To assist you in defining an EJB inheritance relationship, the New Enterprise Bean wizard allows you to create a new enterprise bean that inherits from an existing enterprise bean. The EJB editor allows you to change the inheritance structure of existing enterprise beans, which updates the generated Java code.

This product supports several other ways to change the parent using the wizard available from the Inheritance section of the EJB editor:

Some of the characteristics of EJB inheritance are:

 

Source page and EJB inheritance

If you are modifying CMP entity beans in an inheritance hierarchy, you should use the wizards and interface portions of the EJB deployment descriptor editor, not the Source page. For example, if you want to add or remove CMP fields or change the primary key field of a CMP bean, these fields are synchronized by the tools for all inherited beans, in order to keep the beans in compliance with the EJB specification. Such synchronization may not occur if you change the source in the Source page.