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 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.