Browse DevX
Sign up for e-mail newsletters from DevX


Entity Bean Inheritance in WebSphere Application Server

The lack of guidelines for EJB inheritance in the EJB specification does not mean entity bean inheritance isn't a required feature for J2EE applications. Learn about the inheritance of entity beans so you can develop hierarchal, persistent objects.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

ntity bean inheritance has a lot of confusion surrounding it because the EJB specification does not give any clear guidelines on this topic. EJB specification documents 2.0 and 2.1 say entity bean inheritance (i.e., an entity bean inheriting from another entity bean) will be considered in future specs.

Nevertheless, IBM's WebSphere Application Server (WAS) supports EJB inheritance in conjunction with WebSphere Application Developer (WSAD). With this feature, you can define a type hierarchy for persistent objects that is much like the type hierarchies widely used for transient objects. This article sets clear guidelines for using inheritance in a WebSphere environment, and it examines various options supported by WebSphere for EJB inheritance. It details standard class inheritance and EJB inheritance, comparing their advantages and disadvantages. This guide also provides details regarding implementation and deployment changes, problems, and solutions.

WSAD supports two forms of inheritance:

  • 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.
  • EJB inheritance—An enterprise bean inherits properties (such as CMP fields and relationship roles), methods, and method-level assembly description attributes from another enterprise bean that resides in the same EJB module.

These two inheritance options have the following advantages and disadvantages:

  1. EJB inheritance is easy to implement using WSAD, but standard class inheritance has the advantage of being simple/clear Java inheritance.
  2. In the case of root-leaf mapping, EJB inheritance mapping may not perform as well as standard class inheritance because of the large SQL statements and numerous joins involved. In the case of single table mapping, the extra columns may cause some performance hitches.
  3. Key classes are common to all inherited enterprise beans (i.e., the key class in the child enterprise bean is identical to the key class in the parent enterprise bean).
  4. For standard class inheritance, the EJB references need to be set manually for child beans.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date