cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Zeigler <>
Subject abstract entities, inheritance, etc.
Date Thu, 23 Apr 2009 23:17:11 GMT
So, I was playing around a bit with the "is abstract" flag on abstract  
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.


View raw message