2 Replies Latest reply on Oct 1, 2004 11:37 AM by ___martin___

    EJBQL Problem

    b_boyle18

      Hey my name is Victor......

      I am trying to deploy an application to jboss-3.0.8 but I keep getting the following error:
      org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT OBJECT(a) FROM ProductBean
      AS a WHERE name=?1'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "name" a
      t line 1, column 46.
      Was expecting one of:
      "NOT" ...
      "(" ...
      <COLLECTION_VALUED_PATH> ...
      <STRING_VALUED_PATH> ...
      "CONCAT" ...
      "SUBSTRING" ...
      <BOOLEAN_VALUED_PATH> ...

      I cant see what the problem is, it cant seem to read any of my EJBQL statements---they all seem to be correct because I got them from an onlie example.

      Here is my ejb-jar.xml

      Thanks,

      Victor ;-)

      <ejb-jar >
       <enterprise-beans>
       <entity >
       <ejb-name>Product</ejb-name>
       <home>examples.ProductHome</home>
       <remote>examples.Product</remote>
       <local-home>examples.ProductLocalHome</local-home>
       <local>examples.ProductLocal</local>
       <ejb-class>examples.ProductBean</ejb-class>
       <persistence-type>Container</persistence-type>
       <prim-key-class>examples.ProductPK</prim-key-class>
       <reentrant>False</reentrant>
       <cmp-version>2.x</cmp-version>
       <abstract-schema-name>ProductBean</abstract-schema-name>
       <cmp-field>
       <field-name>productID</field-name>
       </cmp-field>
      
       <cmp-field>
       <field-name>name</field-name>
       </cmp-field>
      
       <cmp-field>
       <field-name>description</field-name>
       </cmp-field>
      
       <cmp-field>
       <field-name>basePrice</field-name>
       </cmp-field>
       <query>
       <query-method>
       <method-name>findByName</method-name>
       <method-params>
       <method-param>java.lang.String</method-param>
       </method-params>
       </query-method>
       <ejb-ql><![CDATA[SELECT OBJECT(a) FROM ProductBean AS a WHERE name=?1]]></ejb-ql>
       </query>
      
       </entity>
      </enterprise-beans>
      
      
       <!-- Assembly Descriptor -->
       <assembly-descriptor>
       <container-transaction>
       <method>
       <ejb-name>Product</ejb-name>
       <method-intf>Remote</method-intf>
       <method-name>*</method-name>
       </method>
       <trans-attribute>Required</trans-attribute>
      
       </container-transaction>
      
       </assembly-descriptor>
      
      </ejb-jar>


        • 1. Re: EJBQL Problem
          blackers

          try

          'SELECT OBJECT(a) FROM ProductBean AS a WHERE a.name=?1'

          or

          'SELECT OBJECT(a) FROM Product AS a WHERE a.name=?1'

          Mat

          • 2. Re: EJBQL Problem
            ___martin___

            Hi.

            You should use the abstract-schema-name of the ejb-jar.xml deployment descriptor for the entity-bean.

            SELECT Object(a) from ProductBean a WHERE a.name = ?1

            (I have not tested the statement.)
            cu,
            martin