openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Ezzio (asmtp)" <dez...@bea.com>
Subject Re: Subclasses instances and query
Date Fri, 10 Aug 2007 16:55:00 GMT
Hi Jan,

When issuing a "select c from Car c", one would normally get back 
objects of type Car, but if there are instances of Audi and Hyundai, 
they should not be returned as instances of Car but as instances of Audi 
or Hyundai, which of course, are objects of type Car.  You should be 
able to cast them down.

Since you can't, I suspect that something in your configuration is 
incorrect.  Can you put together an extraordinarily simple test case 
that demos the problem?

Thanks,

David Ezzio



janek wrote:
> Hi,
> I have problem with query and returned result.
> 
> I have three classes: 
>   superclass Car, 
>   Audi and Hyundai  which extends Car
> 
> After persisting some instances of Audi and H., 
> query "SELECT c FROM Car c" returns the some 
> number of Car instances.
> 
> The problem is that result is only of type Car,
> I can not cast it up to Audi or Hyunday. 
> 
> I understand that this is more efficient, 
> but I need full instances, not just superclass. 
> Is there any switch which will turn "full subclass fetch" on?
> 
> Thanks in advance,
> Jan Kotek
> 
> 
>  


Mime
View raw message