openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "minewile (JIRA)" <j...@apache.org>
Subject [jira] Created: (OPENJPA-420) JPQL constructor query close the <SELECT DISTINCT> feature?
Date Fri, 26 Oct 2007 07:46:50 GMT
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.1


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