db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Jefferson (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (JDO-652) Provision of a statically-typed refactor-friendly query capability for JDOQL
Date Sat, 30 Oct 2010 17:42:20 GMT

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

Andy Jefferson edited comment on JDO-652 at 10/30/10 1:40 PM:
--------------------------------------------------------------

Re: developing model and query objects, if someone wants to give it a try they can put 
"datanucleus-jdo-query.jar" (available in the DN nightly repo) in the Eclipse annotation processor
jar list, enable JDK1.6 compliance, and also have "datanucleus-core.jar" in the CLASSPATH.
They can then create a model class (e.g Product.java) and start writing persistence code that
refers to QProduct, such as
QProduct qp = QProduct.candidate;
and start making references to "qp" and its various methods ... see http://datanucleus.blogspot.com/2010/07/jdo-typesafe-refactorable-queries.html
for the expressions. This is the basis for the various clauses of the proposed query API

Note this is not currently a full working prototype, it just allows creation of the dynamic
query objects and can demonstrate the access of fields, use of methods and relations etc.
An example of the API as currently in DataNucleus SVN

Query<Product> q = pm.newTypesafeQuery(Product.class);
QProduct cand = QProduct.candidate;
q.filter(cand.value.lt(40.00).and(cand.name.startsWith("Wal"))).orderBy(cand.name.asc());
List<Product> results = q.executeList();

The "Query" object here is a different class to the javax.jdo.Query, could be renamed TypesafeQuery
for example. The user can also type "q.toString()" to see the single-string equivalent.

      was (Author: andy):
    Re: developing model and query objects, if someone wants to give it a try they can put

"datanucleus-jdo-query.jar" (available in the DN nightly repo) in the Eclipse annotation processor
jar list, enable JDK1.6 compliance, and also have "datanucleus-core.jar" in the CLASSPATH.
They can then create a model class (e.g Product.java) and start writing persistence code that
refers to QProduct, such as
QProduct qp = QProduct.candidate;
and start making references to "qp" and its various methods ... see http://datanucleus.blogspot.com/2010/07/jdo-typesafe-refactorable-queries.html
for the expressions. This is the basis for the various clauses of the proposed query API

Note this is not currently a full working prototype, it just allows creation of the dynamic
query objects and can demonstrate the access of fields, use of methods and relations etc.
  
> Provision of a statically-typed 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 maintenance release 1
>
>
> 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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message