db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: SQL queries and inheritance
Date Sun, 13 Nov 2005 02:45:32 GMT
Hi Michael,

Yes, an implementation must return the proper instance (including its  
class) at all times. That's why the SELECT statement must include the  
discriminator column if it exists. If there is a discriminator column  
and it's not included in the SELECT statement, it's a JDOUserException.

Craig

On Nov 10, 2005, at 9:53 AM, Michael Watzek wrote:

> Hi Craig,
>
> is it a requirement for an implementation to return the right  
> runtime type when a SQL query selects instances from a pc  
> superclass, e.g.
>
>     String sql = "SELECT personid, firstname,  lastname,  
> middlename, birthdate, addrid, street, city, state, zipcode,  
> country, hiredate, weeklyhours, salary, wage, discriminator FROM  
> persons";
>     Query query = pm.newQuery("javax.jdo.query.SQL", sql);
>     query.setClass(Person.class);
>     query.execute()
>
> Is the query supposed to return fulltime employees and parttime  
> employees?
>
> Regards,
> Michael
> -- 
> -------------------------------------------------------------------
> Michael Watzek                  Tech@Spree Engineering GmbH
> mailto:mwa.tech@spree.de        Buelowstr. 66
> Tel.:  ++49/30/235 520 36       10783 Berlin - Germany
> Fax.:  ++49/30/217 520 12       http://www.spree.de/
> -------------------------------------------------------------------

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message