Re: ParseException with EJBQL expression

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Dec 04 2009 - 08:26:22 EST

  • Next message: Andrus Adamchik: "Re: ParseException with EJBQL expression"

    Right now our parser requires aliases for entities:

    > select COUNT(a) from ProductCollection foo as a where
    > a.productStyles.taxonomy likeIgnoreCase '323.%'

    On Dec 4, 2009, at 4:12 AM, Dave Lamy wrote:

    > Hey guys--
    >
    > I'm really just now getting into using the EJBQLQuery and am having
    > some
    > difficulties. I don't know whether I'm doing something
    > fundamentally wrong
    > or what.
    >
    > Here's my EJBQL expression that I'm trying to get parsed (running
    > 3.0B1):
    >
    > select COUNT(foo) from ProductCollection foo where
    > foo.productStyles.taxonomy likeIgnoreCase '323.%'
    >
    > Parsing this query yields the following exception:
    >
    >
    > org.apache.cayenne.ejbql.parser.ParseException: Encountered "
    > <IDENTIFIER>
    > "foo "" at line 1, column 53.
    > Was expecting:
    > "(" ...
    >
    > 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)
    > at org.apache.cayenne.ejbql.parser.EJBQL.parseQuery(EJBQL.java:41)
    > ...
    >
    > The statement looks legit to me. Is there like a fundamental
    > something I'm
    > not understanding about EJBQL? I saw some docs that showed doing
    > this sort
    > of join alias "IN" thing,
    >
    > SELECT OBJECT(e) FROM Department d, IN(d.employees) e
    > WHERE d.name = ?1 AND e.salary > ?2
    >
    > My problem is that I'm using Expression.toEJBQL() to gen the where
    > clause..
    > was hoping to not have to recreate my code that generates the
    > Expression
    > object.
    >
    > Help!
    >
    > Dave



    This archive was generated by hypermail 2.0.0 : Fri Dec 04 2009 - 08:26:54 EST