3 Replies Latest reply on Aug 6, 2002 1:36 PM by dsundstrom

    EJBQL Parser Exception: Clausule "BETWEEN"

    joseluis

      Hello all:

      I'm working with JBoss 3.0 and I'm trying to do something with CMP.

      I receive this exception:

      ---
      org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "BETWEEN" at line 1, column 107.
      Was expecting one of:
      ">" ...
      ---

      The query is:
      SELECT OBJECT(a) FROM HG_cmeb_EventMonInfo AS a WHERE a.instId = ?1 AND a.instServer = ?2 AND a.timeStamp BETWEEN ?3 AND ?4

      Is it that JBoss does not suppoprt BETWEEN clausule?? (EJB 2.0 Spec supports it !!)

      The courious thing is that JAWS seems to support it.
      But now I'm using JBoss3.0's jbosscmp-jdbc it doesn't work.

      Any idea about this exception ?

      Thanks a lot.

        • 1. Re: EJBQL Parser Exception: Clausule "BETWEEN"
          dsundstrom

          Please take a closer look at the EJB-QL grammar. The specification does not allow the use of a datetime in a between clause. You will need to either use JBossQL or you will need to use the > and < operators.

          • 2. Re: EJBQL Parser Exception: Clausule "BETWEEN"
            euklid

            If you use the symbols < and > in a XML-file, you have to put the SELECT-command in
            <![CDATA[
            SELECT Object(p) FROM table AS p WHERE (p.date <= ?1) AND (p.date >= ?2)
            ]]>

            But if I do so, the JBuilder 6.0 turns my SELECT-command into:
            SELECT Object(p) FROM table AS p WHERE (p.date >= ?1) AND (p.date <= ?2)

            First question: Is this correct?
            Second question: If not, what could I do (except changing my IDE of course ;-) )?

            The error message doesn`t change, although I`m not using BETWEEN clausule anymore...

            Thanks
            Michael

            • 3. Re: EJBQL Parser Exception: Clausule "BETWEEN"
              dsundstrom

              If you read the EJB-QL grammar closely, you will notice that the >= and <= operators are not allowed for datetime types. You are only allowed to use the < and > operators. Borlan allows you to use the other operators in an attempt to make your application less portable.