Expression.fromString() to check Date

From: Williams, Beth (beth.william..FIB.ORG)
Date: Thu Nov 11 2004 - 14:33:05 EST

  • Next message: Mike Kienenberger: "Re: Switching between test and production environment?"

    This is probably a very simple question, but I just can't seem to figure this one out. I am building an Expression in which I need to check a Date field (example: where <date_attribute> = TO_DATE('2004-10-16', 'YYYY-MM-DD'). I have tried the folowing without any luck:

    Expression qual = Expression.fromString("weDt = TO_DATE('2004-10-16', 'YYYY-MM-DD')");

    I've also tried different alternatives with ExpressionFactory and still no luck. I receive the following error when the above Expression is incorporated in a SelectQuery and run in the DataContext. Any input would be greatly appeciated. Thanks.

    ** Error ***
    org.objectstyle.cayenne.exp.ExpressionException: [v.1.1-dev November 4 2004] Encountered "(" at line 1, column 15.
    Was expecting one of:
        <EOF>
        "or" ...
        "and" ...
        "+" ...
        "-" ...
        "*" ...
        "/" ...
        
            at org.objectstyle.cayenne.exp.Expression.fromString(Expression.java:230)
            at org.nfib.core.service.memberships.MembershipServicesImpl.main(MembershipServicesImpl.java:31)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
    Caused by: org.objectstyle.cayenne.exp.parser.ParseException: Encountered "(" at line 1, column 15.
    Was expecting one of:
        <EOF>
        "or" ...
        "and" ...
        "+" ...
        "-" ...
        "*" ...
        "/" ...
        
            at org.objectstyle.cayenne.exp.parser.ExpressionParser.generateParseException(ExpressionParser.java:1392)
            at org.objectstyle.cayenne.exp.parser.ExpressionParser.jj_consume_token(ExpressionParser.java:1328)
            at org.objectstyle.cayenne.exp.parser.ExpressionParser.expression(ExpressionParser.java:88)
            at org.objectstyle.cayenne.exp.Expression.fromString(Expression.java:227)
            ... 6 more
    Exception in thread "main"

    ***********



    This archive was generated by hypermail 2.0.0 : Thu Nov 11 2004 - 14:33:07 EST