You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "minewile (JIRA)" <ji...@apache.org> on 2007/10/26 09:46:50 UTC

[jira] Created: (OPENJPA-420) JPQL constructor query close the feature?

Posted by "Patrick Linskey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564414#action_12564414 ] 

Patrick Linskey commented on OPENJPA-420:
-----------------------------------------

BTW, the change will be available in the 1.0.2-SNAPSHOT in a few hours.

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


[jira] Updated: (OPENJPA-420) JPQL constructor query close the feature?

Posted by "Patrick Linskey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-420?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Linskey updated OPENJPA-420:
------------------------------------

    Fix Version/s: 1.1.0

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


[jira] Commented: (OPENJPA-420) JPQL constructor query close the feature?

Posted by "Patrick Linskey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-420?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Linskey resolved OPENJPA-420.
-------------------------------------

    Resolution: Fixed

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