[JIRA] Commented: (CAY-919) EJBQL Query with relational queries (<, <=, >, >=) are throwing exceptions

From: Garry Watkins (JIRA) ("Garry)
Date: Thu Nov 15 2007 - 14:45:43 EST

  • Next message: Andrus Adamchik (JIRA): "[JIRA] Updated: (CAY-919) EJBQL Query with relational queries (<, <=, >, >=) are throwing exceptions"

        [ https://issues.apache.org/cayenne/browse/CAY-919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12601 ]

    Garry Watkins commented on CAY-919:
    -----------------------------------

    This relational operators are working and not an issue, i forgot to prefix the effectiveDate with an "at.", however it would be nice to have a better error message. However, my question about it returning a data row instead of a List of Objects is still a valid question. Additionally, it is throwing an exception if I alias the sum expression which is an issue. Let me know if I should create a new issue about the aliasing.

    Thanks
    Garry

    > EJBQL Query with relational queries (<, <=, >, >=) are throwing exceptions
    > --------------------------------------------------------------------------
    >
    > Key: CAY-919
    > URL: https://issues.apache.org/cayenne/browse/CAY-919
    > Project: Cayenne
    > Issue Type: Bug
    > Components: Cayenne Core Library
    > Affects Versions: 3.0
    > Environment: Mac OS/X (Leopard), Java 1.5 Cayenne 3.M2
    > Reporter: Garry Watkins
    > Assignee: Andrus Adamchik
    > Priority: Blocker
    >
    > When using a relational operator in an EJBQLQuery it is throwing a ParseException. Additionally shouldn't this return a data row instead a list of an Object[] array? That is assuming that one can alias the selected attributes. However, it appears that you cannot specify an alias.
    > Source:
    > EJBQLQuery q = new EJBQLQuery("SELECT at.isUsage, sum(at.amount), sum(at.hours) FROM AccrualTransaction at WHERE at.accrualCode = :accrualCode and at.employeeID = :employeeID and effectiveDate >= :payrollDate GROUP BY at.isUsage");
    > q.setParameter("accrualCode", bal.getCode());
    > q.setParameter("employeeID", emp.getEmployeeID());
    > q.setParameter("effectiveDate", balanceDate);
    > List results = emp.getObjectContext().performQuery(q); <<== throws exception here
    > System.out.println(results);
    > Error follows:
    > org.apache.cayenne.ejbql.parser.ParseException: Encountered "effectiveDate >=" at line 1, column 149.
    > Was expecting one of:
    > "(" ...
    > "NOT" ...
    > "EXISTS" ...
    > "+" ...
    > "-" ...
    > <DECIMAL_LITERAL> ...
    > <INTEGER_LITERAL> ...
    > ":" ...
    > "?" ...
    > <IDENTIFIER> ...
    > <IDENTIFIER> "." ...
    > "LENGTH" ...
    > "LOCATE" ...
    > "ABS" ...
    > "SQRT" ...
    > "MOD" ...
    > "SIZE" ...
    > "AVG" ...
    > "MAX" ...
    > "MIN" ...
    > "SUM" ...
    > "COUNT" ...
    > "SELECT" ...
    > <STRING_LITERAL> ...
    > "CONCAT" ...
    > "SUBSTRING" ...
    > "TRIM" ...
    > "LOWER" ...
    > "UPPER" ...
    > <BOOLEAN_LITERAL> ...
    > "CURRENT_DATE" ...
    > "CURRENT_TIME" ...
    > "CURRENT_TIMESTAMP" ...
    > "NEW" ...
    > "ALL" ...
    > "ANY" ...
    > "SOME" ...
    > "EMPTY" ...
    > "ASC" ...
    > "DESC" ...
    > "ORDER" ...
    > "IS" ...
    > "MEMBER" ...
    > "OF" ...
    > "LIKE" ...
    > "ESCAPE" ...
    > "BETWEEN" ...
    > "NULL" ...
    > "OR" ...
    > "AND" ...
    > "LEADING" ...
    > "TRAILING" ...
    > "BOTH" ...
    > "DISTINCT" ...
    > "FROM" ...
    > "UPDATE" ...
    > "DELETE" ...
    > "WHERE" ...
    > "GROUP" ...
    > "BY" ...
    > "HAVING" ...
    > "AS" ...
    > "LEFT" ...
    > "OUTER" ...
    > "INNER" ...
    > "JOIN" ...
    > "FETCH" ...
    > "IN" ...
    > "SET" ...
    > "OBJECT" ...
    > <IDENTIFIER> "=" ...
    > <IDENTIFIER> "<>" ...
    > <IDENTIFIER> "NOT" ...
    > <IDENTIFIER> "MEMBER" ...
    >

    -- 
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
    



    This archive was generated by hypermail 2.0.0 : Thu Nov 15 2007 - 14:46:10 EST