abstract entities, inheritance, etc.

From: Robert Zeigler (robert..cazdl.org)
Date: Thu Apr 23 2009 - 19:17:11 EDT

  • Next message: Aristedes Maniatis: "Re: abstract entities, inheritance, etc."

    So, I was playing around a bit with the "is abstract" flag on abstract
    entities.
    I confess that it didn't quite work the way I thought it would.
    For one, the superclass was abstract, but not the subclass. I went
    ahead and made the subclass abstract. Which raises the second issue.
    I have two obj entities entities extending the "abstract" superclass,
    using a single discriminator column. I went to query the base class
    (ala: select e from Entry e), and the query failed, due to the
    inability to instantiate an instance of Entry. Evidently, cayenne is
    trying to instantiate all of the subclasses instances as instances of
    the superclass. Shouldn't cayenne be instantiating the subclasses?
    Put another way, what is the technical reason that cayenne /isn't/
    instantiating the subclasses as instances of the subclasses? Given the
    potential of polymorphism, it seems like instantiating as the
    superclass, even if the superclass is concrete, is incorrect behavior?
    Just trying to clarify, here. I'll be digging through the code to try
    to understand the specifics of how cayenne handles inheritance, but,
    any pointers appreciated.

    Robert



    This archive was generated by hypermail 2.0.0 : Thu Apr 23 2009 - 19:17:56 EDT