You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by "Andy Jefferson (JIRA)" <ji...@apache.org> on 2017/05/07 06:51:04 UTC

[jira] [Commented] (JDO-763) RI does not implement default of Query.setResult

    [ https://issues.apache.org/jira/browse/JDO-763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15999709#comment-15999709 ] 

Andy Jefferson commented on JDO-763:
------------------------------------

Not sure why this is assigned to me. 
If the issue is to add a check to the TCK then just add it (hence not me). 
If the issue is that DataNucleus handling needs to be something different to what it is then somebody should raise an issue on DataNucleus issue tracker, not here, since DataNucleus is not part of Apache JDO as such.

FWIW I added an issue https://github.com/datanucleus/datanucleus-core/issues/211 for DN v5.1, not sure if this is what your test needs to pass since I don't have the time to be adding patches. I haven't backported this fix to DN v5.0 branch. Perhaps if this test requires it then somebody can raise an equivalent issue in DN issue tracking to backport it. 

Thx

> RI does not implement default of Query.setResult
> ------------------------------------------------
>
>                 Key: JDO-763
>                 URL: https://issues.apache.org/jira/browse/JDO-763
>             Project: JDO
>          Issue Type: Bug
>          Components: tck
>    Affects Versions: JDO 3.2
>            Reporter: Michael Bouschen
>            Assignee: Andy Jefferson
>             Fix For: JDO 3.2
>
>         Attachments: SetResultDefault-patch.txt
>
>
> The JDO spec defines in chapter 14.6.9 "Specifying the Result of a Query (Projections, Aggregates)":
> Default Result
> If not specified, the result defaults to “distinct this as C” where C is the unqualified name of the candidate class. For example, the default result specification for a query where the candidate class is com.acme.hr.Employee is “distinct this as Employee”.
> The following query specifies a result class and assumes that the query result defaults to "distinct this as Person". 
>   Query query = pm.newQuery(Person.class, "lastname == 'emp1Last'");
>   //query.setResult("distinct this as Person");
>   query.setResultClass(PersonWrapper.class);
>   Object results = query.execute();
> The above code results in org.datanucleus.exceptions.NucleusUserException: Query needs to return objects of type "org.apache.jdo.tck.query.api.SetResultDefault$PersonWrapper" but it was impossible to set the field "birthdate" type "java.util.Date". The field should have either a public set/put method, or be public.
> The query executes OK when explicitly specifying a result (see line in comments).



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)