2 Replies Latest reply on Nov 5, 2004 8:47 AM by Ancin Peter

    ParseException when using <= operator

    Ancin Peter Newbie

      In JBoss 4.0.0, I am trying to deploy an entity EJB with the following EJBQL statement in it

      SELECT OBJECT(f) FROM address f
      WHERE f.validDate <= ?1

      During deployment I get a ParseException on "<=" operator. According to the EJB 2.0 spec, <= is a valid operator. validDate field is a DATE field in the database.

      On changing the statement as follows, I was able to make it work.

      SELECT OBJECT(f) FROM address f
      WHERE f.validDate < ?1 or f.validDate = ?1

      I am interested in knowing why the first form of SELECT statement did not work.

      Thanks,
      Ancin

        • 1. Re: ParseException when using <= operator
          Joan Horta  Tosas Novice

          I think you're not right when saying that EJB 2.0 spec permits what you were trying to do. As the spec says, datetime_value comparisons only allow these operators: =,<>,>,<. The kind of comparation you wanted to use is restricted to arithmetic types.

          comparison_expression ::=
          string_value { =|<>} string_expression |
          boolean_value { =|<>} boolean_expression} |
          datetime_value { = | <> | > | < } datetime_expression |
          entity_bean_value { = | <> } entity_bean_expression |
          arithmetic_value comparison_operator single_value_designator
          arithmetic_value ::= single_valued_path_expression | functions_returning_numerics
          single_value_designator ::= scalar_expression
          comparison_operator ::=
          = | > | >= | < | <= | <>
          

          This is extracted from the EJB 2.0 spec, on the EJBQL BNF grammar section. I think this answered your question.


          • 2. Re: ParseException when using <= operator
            Ancin Peter Newbie

            You are correct. The BNF does not specify the <= operator. Thanks for the clarification.