5 Replies Latest reply on Jun 20, 2005 4:07 AM by ginovp

    J2EE CMP EJB Error compiling ejbql FROM not found

    murdoch

      Hi,

      I work with Eclipse Lomboz Plugin (XDoclet und ANT) and get following error (short: "FROM not found"), when I try to deploy my Container Managed Persistence EJBs on my JBoss 3.2.0 RC2:

      13:35:44,616 WARN [ServiceController] Problem starting service jboss.j2ee:jndiName=VerbindungstypBean,service=EJB
      org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: FROM not found)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:46)

      What can I do, to solve this problem. The FROM clause of the EJBQL-Query of the Entity Bean (CMP) in the ejb-jar.xml links to a DB-Schema which links again to the actual database table.

      Here's the code part with the EJBQL-query of my ejb-jar.xml:

      <entity >
       <description><![CDATA[]]></description>
      
       <ejb-name>Verbindungstyp</ejb-name>
      
       <home>com.business.verbindung.ejb.VerbindungstypHome</home>
       <remote>com.business.verbindung.ejb.Verbindungstyp</remote>
       <local-home>com.business.verbindung.ejb.VerbindungstypLocalHome</local-home>
       <local>com.business.verbindung.ejb.VerbindungstypLocal</local>
      
       <ejb-class>com.business.verbindung.ejb.VerbindungstypCMP</ejb-class>
       <persistence-type>Container</persistence-type>
       <prim-key-class>java.lang.Integer</prim-key-class>
       <reentrant>False</reentrant>
       <cmp-version>2.x</cmp-version>
       <abstract-schema-name>verbindungstypSchema</abstract-schema-name>
       <cmp-field >
       <description><![CDATA[Returns the id]]></description>
       <field-name>id</field-name>
       </cmp-field>
       <cmp-field >
       <description><![CDATA[Returns the name]]></description>
       <field-name>name</field-name>
       </cmp-field>
       <cmp-field >
       <description><![CDATA[Returns the parentId]]></description>
       <field-name>parentId</field-name>
       </cmp-field>
       <primkey-field>id</primkey-field>
      
       <query>
       <query-method>
       <method-name>findRoots</method-name>
       <method-params>
       </method-params>
       </query-method>
       <ejb-ql><![CDATA[ SELECT OBJECT(vt) FROM verbindungstypSchema vt WHERE vt.parentId = 0]]></ejb-ql>
       </query>
       <query>
       <query-method>
       <method-name>findByParentId</method-name>
       <method-params>
       <method-param>java.lang.Integer</method-param>
       </method-params>
       </query-method>
       <ejb-ql><![CDATA[ SELECT OBJECT(vt) FROM verbindungstypSchema vt WHERE vt.parentId = ?1]]></ejb-ql>
       </query>
       <!-- Write a file named ejb-finders-VerbindungstypBean.xml if you want to define extra finders. -->
       </entity>


      I look forward to your replies :))

      MfG Murdoch!

        • 1. Re: J2EE CMP EJB Error compiling ejbql FROM not found
          erik777

          I use AS to alias entities in the FROM clause. Here's an example of EJB-QL that works:

           <query>
           <query-method>
           <method-name>findByGlobalApplicationDomain</method-name>
           <method-params>
           <method-param>java.lang.Integer</method-param>
           </method-params>
           </query-method>
           <ejb-ql>[CDATA[
           SELECT DISTINCT OBJECT(rm)
           FROM rolemodules AS rm
           WHERE rm.role.application IS NULL AND
           (rm.role.domain IS NULL OR
           rm.role.id = ?1)
          
           ]]</ejb-ql>
           </query>
          

          I'm also using JBoss 3.2.3. Have you considered upgrading?

          • 2. Re: J2EE CMP EJB Error compiling ejbql FROM not found
            murdoch

            Hi,

            thanks for your reply :))

            I will try it.

            MfG Murdoch!

            • 3. Re: J2EE CMP EJB Error compiling ejbql FROM not found
              aloubyansky

              The queries are correct. 'AS' is optional. Are you sure the exception is thrown parsing the queries you posted?
              What if you try a later JBoss version?

              • 4. Re: J2EE CMP EJB Error compiling ejbql FROM not found
                ginovp

                I've got the same problem!
                I'm working with JBuilder 8 + plugin to generate xml descriptors.
                the deployment worked well since i changed the plugin. I have now the same ejbql parse exception. i don't know why because the query doesn't change and seems to be OK.
                Amazingly, the parsing exception occurs on a different entitybean following the jboss version (tested on 3.0.8 and 3.2.7).

                • 5. Re: J2EE CMP EJB Error compiling ejbql FROM not found
                  ginovp

                  Ok! I found where was my problem. some ejbql queries into ejb-jar were set to null => <ejb-ql/> because of overriding queries in the jbosscmp xml. but the new plugin tested with jbuilder deleted all jboss ql definitions.

                  But i spent a lot of time to find this bug because the exception throwed by jboss warn about a wrong entitybean. The null query was defined on a another entitybean. tested on jboss 3.0.8 and jboss 3.2.7.