You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "wilesun (JIRA)" <ji...@apache.org> on 2008/10/22 10:10:44 UTC
[jira] Updated: (OPENJPA-690) JPQL select express support alias
[ https://issues.apache.org/jira/browse/OPENJPA-690?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
wilesun updated OPENJPA-690:
----------------------------
Fix Version/s: (was: 1.1.1)
1.3.0
> JPQL select express support alias
> ---------------------------------
>
> Key: OPENJPA-690
> URL: https://issues.apache.org/jira/browse/OPENJPA-690
> Project: OpenJPA
> Issue Type: Bug
> Components: kernel
> Affects Versions: 1.1.0
> Reporter: wilesun
> Fix For: 1.3.0
>
>
> I hope the JPQL supprt the templete:(it can work with hibernate jpa)
> select o.id, o.name as aName, o.code aCode form A o where ..
> I modifid the jpql.jtt
> 1.jpql.jtt
> void select_expression() #SELECTEXPRESSION : { }
> {
> ((aggregate_select_expression()
> | LOOKAHEAD(path()) path()
> | identification_variable()
> | (<OBJECT> "(" identification_variable() ")")
> | constructor_expression()
> | select_extension()
> | string_literal()
> | numeric_literal()) [LOOKAHEAD(1)<AS>] [LOOKAHEAD(identification_variable())identification_variable()])
> }
> 2:openjpa-kernel\src\main\java\org\apache\openjpa\kernel\jpql\JPQLExpressionBuilder.java
> private Expression assignProjections(JPQLNode parametersNode,
> QueryExpressions exps) {
> int count = parametersNode.getChildCount();
> exps.projections = new Value[count];
> exps.projectionClauses = new String[count];
> exps.projectionAliases = new String[count];
> Expression exp = null;
> for (int i = 0; i < count; i++) {
> JPQLNode parent = parametersNode.getChild(i);
> JPQLNode projNode = firstChild(parent);
> JPQLNode aliasNode = parent.children.length > 1 ? right(parent) : null;;
>
> Value proj = getValue(projNode);
> String alias = aliasNode == null ? lastChild(projNode).text : aliasNode.text;
>
> exps.projections[i] = proj;
> exps.projectionClauses[i] = assemble(projNode);
> exps.projectionAliases[i] = alias;
> }
> return exp;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.