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

Andy Jefferson commented on JDO-652:
------------------------------------

There are (at least) 2 options for the execution part. 
1. Allow creation of Query on the PMF, PM, and then execute on the PM.
Query q = pmf.createQuery(...)
pm1.executeQuery(q);
pm2.executeQuery(q);
This has complications of the fact that the Query takes its FetchPlan from the 
PM that creates it (which may be modified from the default FetchPlan) yet with 
this has to start from a default FetchPlan, it means people will have to make 
large changes to their existing code (or use deprecated methods all over the 
place).

2. Create a Query like now, on the PM, and have the generic Query (what we have 
now) and the new JDOQLTypedQuery implement QueryExecutor. So we can have 
consistent execute methods across the Query and JDOQLTypedQuery. Not sure we 
can do the same with QueryDefinition (other than some of the basic 
getter/setter stuff) since the JDOQLTypedQuery will be using the 
javax.jdo.query.XXXExpression classes in its filter(), groupBy(), orderBy(), 
... methods and the generic one uses Strings.


For the first one, who has this use-case of requiring a Query to be useable 
across PMs? A JDO impl will cache the query+compilation already, PM can save it 
as named and access the named query in another PM.

Other requirements ?
* JDOQLTypedQuery.toString() should return the equivalent single-string JDOQL, 
so can be converted in that direction.
* do we need to be able to convert from (JDOQL) single-string to 
JDOQLTypedQuery?

SVN now has the JDOQLTypedQuery (and Subquery) added for reference/discussion.

> Provision of a typesafe refactor-friendly query capability for JDOQL
> --------------------------------------------------------------------
>
>                 Key: JDO-652
>                 URL: https://issues.apache.org/jira/browse/JDO-652
>             Project: JDO
>          Issue Type: New Feature
>          Components: api, specification, tck
>            Reporter: Andy Jefferson
>             Fix For: JDO 3.2
>
>         Attachments: typesafe.patch, typesafe_manifest.patch
>
>
> There are various querying capabilities of this type around. JPA2 has its 
> Criteria query API. Third party solutions like QueryDSL also exist, in its 
> case providing a JDOQL implementation (as well as JPQL, and HQL). We should 
> seriously consider introducing something along these lines in the JDO2.4 
> timeframe. 
> There is a comparison of JPA Criteria with QueryDSL over at 
> http://source.mysema.com/forum/mvnforum/viewthread_thread,49



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

Reply via email to