2 Replies Latest reply on Jan 11, 2004 3:21 AM by Juha Lindfors

    Cannot use >= or <= with Timestamp in EJB-QL?

    carl Newbie

      Hi,

      I'm using JBoss 3.2.2. When I attempt to use the <= or >= comparators in the EJB-QL for a finder where the attribute is a java.sql.Timestamp, I get the following deployment error:

      org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT OBJECT(e) from Event e where e.eventTypeCode = ?1 and ((e.scheduledStartDateCMP >=
      ?2 and e.scheduledStartDateCMP <= ?3 and e.stateCode <> 'D') or e.stateCode='C')'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "e.scheduledStartDateCMP >=" at line 1, column 66.
      Was expecting one of:
      "ABS" ...
      "LENGTH" ...
      "LOCATE" ...
      "SQRT" ...
      "(" ...
      "+" ...
      "-" ...
      <INTEGER_LITERAL> ...
      <FLOATING_POINT_LITERAL> ...
      <NUMERIC_VALUED_PARAMETER> ...
      <NUMERIC_VALUED_PATH> ...
      "NOT" ...
      <COLLECTION_VALUED_PATH> ...
      <STRING_VALUED_PATH> ...
      "CONCAT" ...
      "SUBSTRING" ...
      <BOOLEAN_VALUED_PATH> ...
      <DATETIME_VALUED_PATH> "=" ...
      <DATETIME_VALUED_PATH> ">" ...
      <DATETIME_VALUED_PATH> "<" ...
      <DATETIME_VALUED_PATH> "<>" ...
      <ENTITY_VALUED_PATH> ...
      <IDENTIFICATION_VARIABLE> ...
      )

      When I stick to strictly a "<" or ">" operator, it works fine, so I can always reformulate as ("=" OR ">"), but that's certainly getting clunky...

      - Carl