Entity Bean Inheritance and Polymorphism

Inheritance is a key advantage of object-oriented systems. Objects in a hierarchy gain functionality from their parents or superclasses. Object-oriented systems also generally provide polymorphism, the capability to define common operations across distinct types. EJBs, especially entity beans, can take advantage of inheritance and polymorphism. An EJB programmer might define an employee entity bean with common methods such as getName and getSalary.

The programmer could then define a manager entity bean that extends the employee entity bean and adds manager-specific information. A method such as getSubordinates, for example, could return the manager's employees. The advantage of using inheritance is that ...

Get J2EE™ Applications and BEA™ WebLogic Server™ now with O’Reilly online learning.

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