You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Andreas Hartmann <an...@apache.org> on 2010/01/20 18:29:01 UTC
ParseException in EJBQL statement with upper function
Hi everyone,
I'm taking my first steps with EJBQL.
Can someone spot the error in the following statement?
SELECT count(t) FROM User t WHERE
(upper(t.email) LIKE upper('%andreas.hartmann@gmail.com%')) OR
(upper(t.email) LIKE upper('%nobby@macbay.de%'))
The exception is:
Caused by: org.apache.cayenne.ejbql.parser.ParseException: Encountered "
"UPPER" "upper "" at line 1, column 36.
Was expecting one of:
"(" ...
"(" ...
"(" ...
"(" ...
"(" ...
"(" ...
"(" ...
"(" ...
"(" ...
"(" ...
"(" ...
"(" ...
"(" ...
"(" ...
"(" ...
at
org.apache.cayenne.ejbql.parser.EJBQL.generateParseException(EJBQL.java:9419)
at
org.apache.cayenne.ejbql.parser.EJBQL.jj_consume_token(EJBQL.java:9298)
at
org.apache.cayenne.ejbql.parser.EJBQL.conditional_primary(EJBQL.java:1933)
at
org.apache.cayenne.ejbql.parser.EJBQL.conditional_factor(EJBQL.java:1911)
at
org.apache.cayenne.ejbql.parser.EJBQL.conditional_term(EJBQL.java:1776)
at
org.apache.cayenne.ejbql.parser.EJBQL.conditional_expression(EJBQL.java:1738)
at
org.apache.cayenne.ejbql.parser.EJBQL.conditional_primary(EJBQL.java:1928)
at
org.apache.cayenne.ejbql.parser.EJBQL.conditional_factor(EJBQL.java:1911)
at
org.apache.cayenne.ejbql.parser.EJBQL.conditional_term(EJBQL.java:1776)
at
org.apache.cayenne.ejbql.parser.EJBQL.conditional_expression(EJBQL.java:1738)
at
org.apache.cayenne.ejbql.parser.EJBQL.where_clause(EJBQL.java:1585)
at
org.apache.cayenne.ejbql.parser.EJBQL.select_statement(EJBQL.java:69)
Thanks a lot in advance!
Best regards,
Andreas
--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01
Re: ParseException in EJBQL statement with upper function
Posted by Andreas Hartmann <an...@apache.org>.
Am 20.01.10 19:57, schrieb Andrey Razumovsky:
> Looks like a bug, could you please report it?
Done: https://issues.apache.org/jira/browse/CAY-1370
> In the meanwhile, this can be used:
>
> SELECT count(t) FROM User t WHERE
> (upper(t.email) LIKE '%ANDREAS.HARTMANN@GMAIL.COM%') OR
> (upper(t.email) LIKE '%NOBBY@MACBAY.DE%')
Yes, I guess I'll transform all string literals to uppercase before
executing the query. Thanks for the hint!
Best regards,
Andreas
>
>
> 2010/1/20 Andreas Hartmann<an...@apache.org>
>
>> Hi everyone,
>>
>> I'm taking my first steps with EJBQL.
>> Can someone spot the error in the following statement?
>>
>>
>> SELECT count(t) FROM User t WHERE
>> (upper(t.email) LIKE upper('%andreas.hartmann@gmail.com%')) OR
>> (upper(t.email) LIKE upper('%nobby@macbay.de%'))
>>
>>
>> The exception is:
>>
>> Caused by: org.apache.cayenne.ejbql.parser.ParseException: Encountered "
>> "UPPER" "upper "" at line 1, column 36.
>> Was expecting one of:
>> "(" ...
>> "(" ...
>> "(" ...
>> "(" ...
>> "(" ...
>> "(" ...
>> "(" ...
>> "(" ...
>> "(" ...
>> "(" ...
>> "(" ...
>> "(" ...
>> "(" ...
>> "(" ...
>> "(" ...
>>
>> at
>> org.apache.cayenne.ejbql.parser.EJBQL.generateParseException(EJBQL.java:9419)
>> at
>> org.apache.cayenne.ejbql.parser.EJBQL.jj_consume_token(EJBQL.java:9298)
>> at
>> org.apache.cayenne.ejbql.parser.EJBQL.conditional_primary(EJBQL.java:1933)
>> at
>> org.apache.cayenne.ejbql.parser.EJBQL.conditional_factor(EJBQL.java:1911)
>> at
>> org.apache.cayenne.ejbql.parser.EJBQL.conditional_term(EJBQL.java:1776)
>> at
>> org.apache.cayenne.ejbql.parser.EJBQL.conditional_expression(EJBQL.java:1738)
>> at
>> org.apache.cayenne.ejbql.parser.EJBQL.conditional_primary(EJBQL.java:1928)
>> at
>> org.apache.cayenne.ejbql.parser.EJBQL.conditional_factor(EJBQL.java:1911)
>> at
>> org.apache.cayenne.ejbql.parser.EJBQL.conditional_term(EJBQL.java:1776)
>> at
>> org.apache.cayenne.ejbql.parser.EJBQL.conditional_expression(EJBQL.java:1738)
>> at
>> org.apache.cayenne.ejbql.parser.EJBQL.where_clause(EJBQL.java:1585)
>> at
>> org.apache.cayenne.ejbql.parser.EJBQL.select_statement(EJBQL.java:69)
>>
>>
>>
>> Thanks a lot in advance!
>>
>> Best regards,
>> Andreas
>>
>>
>>
>> --
>> Andreas Hartmann, CTO
>> BeCompany GmbH
>> http://www.becompany.ch
>> Tel.: +41 (0) 43 818 57 01
>>
>>
>
>
--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01
Re: ParseException in EJBQL statement with upper function
Posted by Andrey Razumovsky <ra...@gmail.com>.
Looks like a bug, could you please report it?
In the meanwhile, this can be used:
SELECT count(t) FROM User t WHERE
(upper(t.email) LIKE '%ANDREAS.HARTMANN@GMAIL.COM%') OR
(upper(t.email) LIKE '%NOBBY@MACBAY.DE%')
2010/1/20 Andreas Hartmann <an...@apache.org>
> Hi everyone,
>
> I'm taking my first steps with EJBQL.
> Can someone spot the error in the following statement?
>
>
> SELECT count(t) FROM User t WHERE
> (upper(t.email) LIKE upper('%andreas.hartmann@gmail.com%')) OR
> (upper(t.email) LIKE upper('%nobby@macbay.de%'))
>
>
> The exception is:
>
> Caused by: org.apache.cayenne.ejbql.parser.ParseException: Encountered "
> "UPPER" "upper "" at line 1, column 36.
> Was expecting one of:
> "(" ...
> "(" ...
> "(" ...
> "(" ...
> "(" ...
> "(" ...
> "(" ...
> "(" ...
> "(" ...
> "(" ...
> "(" ...
> "(" ...
> "(" ...
> "(" ...
> "(" ...
>
> at
> org.apache.cayenne.ejbql.parser.EJBQL.generateParseException(EJBQL.java:9419)
> at
> org.apache.cayenne.ejbql.parser.EJBQL.jj_consume_token(EJBQL.java:9298)
> at
> org.apache.cayenne.ejbql.parser.EJBQL.conditional_primary(EJBQL.java:1933)
> at
> org.apache.cayenne.ejbql.parser.EJBQL.conditional_factor(EJBQL.java:1911)
> at
> org.apache.cayenne.ejbql.parser.EJBQL.conditional_term(EJBQL.java:1776)
> at
> org.apache.cayenne.ejbql.parser.EJBQL.conditional_expression(EJBQL.java:1738)
> at
> org.apache.cayenne.ejbql.parser.EJBQL.conditional_primary(EJBQL.java:1928)
> at
> org.apache.cayenne.ejbql.parser.EJBQL.conditional_factor(EJBQL.java:1911)
> at
> org.apache.cayenne.ejbql.parser.EJBQL.conditional_term(EJBQL.java:1776)
> at
> org.apache.cayenne.ejbql.parser.EJBQL.conditional_expression(EJBQL.java:1738)
> at
> org.apache.cayenne.ejbql.parser.EJBQL.where_clause(EJBQL.java:1585)
> at
> org.apache.cayenne.ejbql.parser.EJBQL.select_statement(EJBQL.java:69)
>
>
>
> Thanks a lot in advance!
>
> Best regards,
> Andreas
>
>
>
> --
> Andreas Hartmann, CTO
> BeCompany GmbH
> http://www.becompany.ch
> Tel.: +41 (0) 43 818 57 01
>
>
--
Andrey