4 Replies Latest reply on Jan 6, 2006 8:15 AM by sunnyyfl

    POJO Inheritance and EJB3

    Matthew Excell Newbie

      Background:

      We are re-vamping our MDA framework to handle EJB3.

      The architecture calls for an abstract superclass that defines all of the UML-specified items - specifically, it implements all of the getters and setters based on the attributes in the diagram. This superclass would therefore contain all of the annotations to define table names, column names, relationships (from associations in the diagrams) , etc. It also contains abstract methods for all the operations in the diagram.

      A subclass that extends the above mentioned base class implements the operations from the diagram and allows for any required customizations.

      The Question:

      It appears that we cannot just put all of the annotations in the superclass and extend it for the subclass. The EJB3 engine (JBoss 4.0.3RC1) doesn't see the subclass as an Entity object. I don't think this is a case for EJB inheritance, because there is actually only one "object" even though it is implemented in multiple classes.

      How do we do what I am describing in EJB3? I would have thought that the annotations would inherit into the subclass, and the abstract nature of the superclass would keep it from being "implemented" by the EJB3 engine. Unfortunately, when the classes get deployed through the EJB3 deployer, the subclass doesn't get deployed as an entity bean, and the abstract class get deployed as an entity bean (with errors that it cannot handle the CMRs - which are of subclass types.)

      I have spent a significant amount of time looking for information about how this is handled in EJB3 - in the spec, in these forums, and in search engines - to no avail.

      I am interested in any ideas about how to make something like this work.

      Thanks in advance.

      Note: My apologies for posting this first to the EJB 3.0 design forum. (I don't believe this user forum existed at the time.) The question is in fact about something that doesn't seem to be addressed in the spec. If I am wrong, please point me at the relevent section.