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