3 Replies Latest reply on Dec 4, 2003 3:11 AM by null null

    Error compiling EJB-QL statement

    null null Newbie

      I run jboss 3.2.2 with Tomcat.

      When I deploy a CMP EJB I get the
      error below. Do you have any idea of
      what could be the reason of the message?

      Thanks.
      U.


      2003-12-03 15:28:21,437 ERROR [org.jboss.ejb.EntityContainer] Starting failed
      org.jboss.deployment.DeploymentException:
      Error compiling EJB-QL statement '
      select object(o) from myobject o where o.mypro BETWEEN ?1 and ?2

      '; - nested throwable:
      (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "BETWEEN" at line 1, column 62.
      Was expecting one of:
      "=" ...
      "<>" ...
      )

        • 1. Re: Error compiling EJB-QL statement
          Barry Gaunt Newbie

          Does it work if you replace ?1 and ?2 by literals?

          • 2. Re: Error compiling EJB-QL statement
            Barry Gaunt Newbie

            The following works fine for me with JBoss 3.2.2 (This is a modified example I found in the JBOSS Workbook for EnterpriseJavaBeans 3rd Edition):

            <query-method> <method-name>findByTonnageBetweenVariables</method-name>
            <method-params>
            <method-param>double</method-param>
            <method-param>double</method-param>
            </method-params>
            </query-method>
            <ejb-ql>
            SELECT OBJECT( s ) FROM Ship s
            WHERE s.tonnage BETWEEN ?1 AND ?2
            </ejb-ql>

            • 3. Re: Error compiling EJB-QL statement
              null null Newbie

              I guess the problem is that my field in the where select is a String
              and with String in Jboss I can just use <> or =.
              Does anyone know if with String I can use just
              <> and = in EJBQL select?

              If it would be so it's quite strange because with websphere > between and < work with String and
              in Sun J2EE tutorials I can't find this limit in EJBQL
              and you can use between > and < with Strings...


              Ok

              Let me know.

              Thanks.
              U.