You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Patrick Linskey (JIRA)" <ji...@apache.org> on 2008/01/31 18:23:08 UTC
[jira] Commented: (OPENJPA-420) JPQL constructor query close the
[ https://issues.apache.org/jira/browse/OPENJPA-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564412#action_12564412 ]
Patrick Linskey commented on OPENJPA-420:
-----------------------------------------
Resolved in 1.0.x line. Thanks for the fix!
> JPQL constructor query close the <SELECT DISTINCT> feature?
> ------------------------------------------------------------
>
> Key: OPENJPA-420
> URL: https://issues.apache.org/jira/browse/OPENJPA-420
> Project: OpenJPA
> Issue Type: Bug
> Components: kernel
> Affects Versions: 1.0.0
> Reporter: minewile
> Fix For: 1.0.2
>
>
> DISTINCT keyword,It can be supported in the simple query and subquery,but use constructor query,example:select distinct new org.apache.A(a.id...),the distinct keyword is ignored .
> I fixed as so:
> java file:org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder
> private Expression evalSelectClause(QueryExpressions exps) {
> if (exps.operation != QueryOperations.OP_SELECT)
> return null;
> JPQLNode selectNode = root();
> JPQLNode constructor = selectNode.findChildByID(JJTCONSTRUCTOR, true);
> if (constructor != null) {
> ...
> // add:now assign the distinct of the select clause
> JPQLNode selectClause = selectNode.findChildByID(JJTSELECTCLAUSE, false);
> if (selectClause != null && selectClause.hasChildID(JJTDISTINCT))
> exps.distinct = exps.DISTINCT_TRUE | exps.DISTINCT_AUTO;
> else
> exps.distinct = exps.DISTINCT_FALSE;
>
> return assignProjections(right(constructor), exps);
> } else {
> ..
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.