Ognjen-

The specification doesn't appear to say whether or not a newline is allowed in queries or not. Our parser seems to disallow it, so I don't think it is currently possible to have a query with a newline in it.


On Jun 13, 2007, at 5:03 PM, Ognjen Blagojevic wrote:

Hi all,

I have problem with EJBQL query in orm.xml file. If the query is single-line, like this:

<named-query name="Test.findAll">
   <query>
       select o from Test o
   </query>
</named-query>

then everything works just fine. But if I i try to split it into several lines, like this:

<named-query name="Test.findAll">
   <query>
       select o
         from Test o
   </query>
</named-query>

then I get the following exception (reformated for clarity):

<0.9.7-incubating nonfatal user error> org.apache.openjpa.persistence.ArgumentException:
An error occurred while parsing the query filter

          'select o
         from Test o'.
Error message: org.apache.openjpa.kernel.jpql.TokenMgrError: Lexical error at line 1, column 10. Encountered: "\n" (10), after : ""

at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder $ParsedJPQL.parse(JPQLExpressionBuilder.java:1656) at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder $ParsedJPQL.<init>(JPQLExpressionBuilder.java:1639) at org.apache.openjpa.kernel.jpql.JPQLParser.parse (JPQLParser.java:47)
...

Ani hints? How can I make a multi-line query?

Thanks,
Ognjen


Reply via email to