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

Andy Jefferson edited comment on JDO-736 at 6/27/15 11:11 AM:
--------------------------------------------------------------

One problem with having 
setParameters(Map namedParamMap);
setParameters(Object... numberedParamValues);

is that if there is a single (numbered) parameter and it just happens to be of 
type java.util.Map then this will go through the former method. Hence

setNamedParameters(Map namedParamMap);
setParameters(Object... numberedParamValues);

Also, to be consistent with the current spec and execute() methods, the 
javadocs of these methods should state that the parameters set via these setter 
methods are only to be used in the subsequent execute/deletePersistentAll call, 
and will not be retained thereafter.


was (Author: andy):
One problem with having 
setParameters(Map namedParamMap);
setParameters(Object... numberedParamValues);

is that if there is a single (numbered) parameter and it just happens to be of 
type java.util.Map then this will go through the former method. Hence

setNamedParameters(Map namedParamMap);
setParameters(Object... numberedParamValues);

> Change Query API to make use of generics to avoid casting execute() results
> ---------------------------------------------------------------------------
>
>                 Key: JDO-736
>                 URL: https://issues.apache.org/jira/browse/JDO-736
>             Project: JDO
>          Issue Type: New Feature
>          Components: api, specification, tck
>            Reporter: Andy Jefferson
>             Fix For: JDO 3.2
>
>         Attachments: JDO-736.patch
>
>
> The query API is dated, requiring casting of results to the required type. 
> Let's make use of generics etc and remove the pain. This will mean changing 
> the API so that the resultClass (and possibly more) will need passing into 
> the 
> execute() method(s). Could also specify parameters via setter rather than 
> just on the execute. 
> See JDO-652 also, we need to have a consistent way of executing queries 
> whether created using strings or typesafe, so that no casting of results is 
> needed with either



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to