2 Replies Latest reply on Oct 18, 2002 3:01 AM by Stratos Nikolaidis

    EJBQL - Where is the error?

    Stratos Nikolaidis Newbie

      Hi!
      I am trying to create an EJB with some finders, using JBoss template (ant+xdoclet).
      The queries are the following:

      DoyBean.java:
      /**
       * @ejb:bean name="myApp/Doy"
       * @ejb:blah-blah value="blah-blah.."
       * @ejb:finder
       *    signature="java.util.Collection findAll()"
       * @ejb:finder
       *    signature="java.util.Collection findAllIDzByCode()"
       *    query="SELECT OBJECT(i) FROM doy AS d, IN(d.doy_id) AS i ORDER BY d.doy_code"
       * @ejb:finder
       *    signature="java.util.Collection findAllIDzByName()"
       *    query="SELECT OBJECT(i) FROM doy AS d, IN(d.doy_id) AS i ORDER BY d.doy_name"
       * @ejb:finder
       *    signature="com.protasys.ejb.interfaces.Doy findByCode(java.lang.String doy_code)"
       *    query="SELECT OBJECT(d) FROM doy d WHERE d.doy_code = ?1"
       * @ejb:finder
       *    signature="com.protasys.ejb.interfaces.Doy findByName(java.lang.String doy_name)"
       *    query="SELECT OBJECT(d) FROM doy d where d.doy_name = ?1"
       * @ejb:finder
       *    signature="com.protasys.ejb.interfaces.Doy findAnotherByCode(java.lang.String doy_id, java.lang.String doy_code)"
       *    query="SELECT OBJECT(d) FROM doy d WHERE d.doy_id <> ?1 AND d.doy_code = ?2"
       * @ejb:finder
       *    signature="com.protasys.ejb.interfaces.Doy findAnotherByName(java.lang.String doy_id, java.lang.String doy_name)"
       *    query="SELECT OBJECT(d) FROM doy d WHERE d.doy_id <> ?1 AND d.doy_name = ?2"
       **/

      The queries, after executing ant, are created succesfully in the ejb-jar.xml file, for example, here is the first query:

        <ejb-name>myApp/Doy</ejb-name>
        <blah-blah/>
        
          <query-method>
            <method-name>findAllIDzByCode</method-name>
            <method-params></method-params>
          </query-method>
          <ejb-ql><![CDATA[
            SELECT
              OBJECT(i)
            FROM
              doy AS d, IN(d.doy_id) AS i
            ORDER BY
              d.doy_code
            ]]></ejb-ql>
          


      But, when I deploy the jar file on JBoss 3.0.0, it returns several error messages about ejbql such as the following:

      12:33:48,415 ERROR [EjbModule] Starting failed
      org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "doy" at line 1, column 23.
      Was expecting one of:
          "IN" ...
          <ABSTRACT_SCHEMA> ...
          )
              at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:46)
              at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createEJBQLQuery(JDBCCommandFactory.java:44)
              at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManager.java:214)
              at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:389)
              at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:198)
              at org.jboss.ejb.EntityContainer.start(EntityContainer.java:376)
              at org.jboss.ejb.Container.invoke(Container.java:793)
              at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
              at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:894)
              at $Proxy6.start(Unknown Source)
              at org.jboss.system.ServiceController.start(ServiceController.java:340)
              at org.blah.blah..

      Where is the error?