db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew T. Adams (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JDO-652) Provision of a typesafe refactor-friendly query capability for JDOQL
Date Tue, 09 Nov 2010 14:54:08 GMT

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

Matthew T. Adams commented on JDO-652:

I admit to not having followed the design discussions too closely, but there was one line
that tripped me up when reading your blog.  It was the last example, that of a subselect:

/* 1 */ TypesafeQuery<Product> tq = pm.newTypesafeQuery(Product.class);
/* 2 */ QProduct cand = QProduct.candidate();
/* 3 */ TypesafeSubquery tqsub = tq.subquery(Product.class, "q");
/* 4 */ QProduct candsub = QProduct.candidate("q");
/* 5 */ List<Product> results =  tq.filter(cand.value.lt(tqsub.select(candsub.value.avg()))).executeList();

On line 3, I expected to see TypesafeSubquery as a generic declaration, TypesafeSubquery<Product>.
 I realize that that since it's coming from its superselect instance (of type TypesafeQuery<Product>),
the subselect can know the type of the candidate class of its superselect.

Question 1:  Why is the declaration not "TypesafeSubquery<Product>"?

Question 2:  If the subselect queries the same candidate class as the superselect, could we
not provide an overload for TypesafeQuery<T>'s subquery method that has the signature
"TypesafeSubquery<T> subquery(string name)"?

> 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 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.

View raw message