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 Fri, 24 Apr 2009 06:51:09 GMT
This was with a SelectQuery already.

Just verified that you're right: this is a problem with my qualifiers.

The column type is varchar.  I was trying to map the object property  
as an enum.  But I wasn't sure how to specify the qualifier, so I  
tried as:

entryType = 'ENUM_CONST_NAME'

Which failed.  When I changed the java type of entryType to string,  
cayenne properly instantiated the subclasses.
So I suppose that raises the question of whether we support enum- 
mapped properties as the discriminators, and if so, what's the proper  
syntax for specifying the enum constant in the qualifier field?


On Apr 24, 2009, at 4/241:23 AM , Andrus Adamchik wrote:

> On Apr 24, 2009, at 5:35 AM, Robert Zeigler wrote:
>> No, it's a bit more complicated.  The template is one portion of  
>> the fix, but even if the entity is marked abstract (in both the  
>> mapping and the java class), cayenne will try to instantiate it in  
>> the aforementioned query on superclass case.  So a complete  
>> solution will require that case to resolve and instantiate the  
>> subclass types, rather than attempting to instantiate the  
>> superclass type.
>> Robert
> Hi Robert,
> The whole logic for instantiating an object of a given class is  
> based on the combination of entity qualifiers in the hierarchy  
> (including on the base class).  So unless this is a bug specific to  
> EJBQLQuery (could you try the same thing with SelectQuery?), maybe  
> the condition on a given result set row yielded a base class somehow?
> Could you post the stack trace and entity qualifiers?
> Thanks,
> Andrus

View raw message