openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Lee (JIRA)" <j...@apache.org>
Subject [jira] Updated: (OPENJPA-420) JPQL constructor query close the <SELECT DISTINCT> feature?
Date Tue, 30 Oct 2007 15:35:50 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-420?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Albert Lee updated OPENJPA-420:
-------------------------------

    Fix Version/s:     (was: 1.0.1)
                   1.0.2

Defer to next release.

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


Mime
View raw message