openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrice Duroux <patrice.dur...@gmail.com>
Subject problem with JPQL named query using a reserved word in field alias
Date Thu, 17 Dec 2020 16:17:38 GMT
Hi
Here are all the JPQL queries tried but none worked.
Is there another alternative? Is this an issue in OpenJPA?

Thanks,
Patrice


<named-query name="SQLgroups">
<query><![CDATA[SELECT DISTINCT g.name AS name,g.geneType AS group FROM
Group g ORDER BY g.name]]></query>
</named-query>

org.apache.openjpa.persistence.ArgumentException: "Encountered "group" at
character 46, but expected: [<IDENTIFIER>]." while parsing JPQL "SELECT
DISTINCT g.name AS name,g.geneType AS group FROM Group g ORDER BY g.name".
See nested stack trace for original parse error.
    at org.apache.openjpa.kernel.jpql.JPQLParser.parse(JPQLParser.java:54)
~[openjpa-3.1.2.jar:3.1.2]

<named-query name="SQLgroups">
<query><![CDATA[SELECT DISTINCT g.name AS name,g.geneType AS `group` FROM
Group g ORDER BY g.name]]></query>
</named-query>

org.apache.openjpa.persistence.ArgumentException: An error occurred while
parsing the query filter 'SELECT DISTINCT g.name AS name,g.geneType AS
`group` FROM Group g ORDER BY g.name'. Error message:
org.apache.openjpa.kernel.jpql.TokenMgrError: Lexical error at line 1,
column 46.  Encountered: "`" (96), after : ""
    at
org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.parse(JPQLExpressionBuilder.java:2443)
~[openjpa-3.1.2.jar:3.1.2]

<named-query name="SQLgroups">
<query><![CDATA[SELECT DISTINCT g.name AS name,g.geneType AS 'group' FROM
Group g ORDER BY g.name]]></query>
</named-query>

org.apache.openjpa.persistence.ArgumentException: "Encountered "\'group\'"
at character 46, but expected: [<IDENTIFIER>]." while parsing JPQL "SELECT
DISTINCT g.name AS name,g.geneType AS 'group' FROM Group g ORDER BY g.name".
See nested stack trace for original parse error.
    at org.apache.openjpa.kernel.jpql.JPQLParser.parse(JPQLParser.java:54)
~[openjpa-3.1.2.jar:3.1.2]

<named-query name="SQLgroups">
<query><![CDATA[SELECT DISTINCT g.name AS name,g.geneType AS "group" FROM
Group g ORDER BY g.name]]></query>
</named-query>

org.apache.openjpa.persistence.ArgumentException: "Encountered "\"group\""
at character 46, but expected: [<IDENTIFIER>]." while parsing JPQL "SELECT
DISTINCT g.name AS name,g.geneType AS "group" FROM Group g ORDER BY g.name".
See nested stack trace for original parse error.
    at org.apache.openjpa.kernel.jpql.JPQLParser.parse(JPQLParser.java:54)
~[openjpa-3.1.2.jar:3.1.2]

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message