cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Zeigler <>
Subject Re: abstract entities, inheritance, etc.
Date Mon, 09 Apr 2012 11:39:49 GMT
Hm, good question.  THis was long enough ago that I don't remember. I'll see if I can dig up
the relevant code to see what I did.


On Apr 8, 2012, at 4/88:44 AM , Michael Gentry wrote:

> Hi Robert,
> To resurrect a really old thread, I was wondering if you ever found a
> solution or workaround to this problem?  I was helping another project
> at work on Friday that hit the same issue.
> Thanks,
> mrg
> On Thu, Apr 23, 2009 at 7:17 PM, Robert Zeigler <> wrote:
>> 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

View raw message