2 Replies Latest reply on Apr 16, 2004 12:44 PM by Bensen Chiou

    EJBQLParser throws generateParseException

    Bensen Chiou Newbie

      Can anyone tell me how to fix the deployment problem on JBoss 4.0.0DR3?

      I have an application Ear file which was running fine on JBoss 3.2.4RC1.
      When I tried to run it on JBoss 4.0.0DR3, I got an ejbql.EJBQLParser.generateParseException.

      A. The ejb-jar.xml file has the following descriptor:
      1. (local only) Customer entity has primary key, userId, of String type.
      2. (local only) Order entity has the following query method:


      <query-method>
      <method-name>findByCustomer</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <ejb-ql><![CDATA[SELECT OBJECT(o) FROM Order AS o WHERE o.customer.userId = ?1]]></ejb-ql>

      3. Customer has one-to-many relationship with Order with following deployment descriptor:
      <ejb-relation >
      <ejb-relation-name>order-customer</ejb-relation-name>

      <ejb-relationship-role >
      <ejb-relationship-role-name>order-belongs_to-customer</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>Order</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>customer</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>

      <ejb-relationship-role >
      <ejb-relationship-role-name>customer-has-orders</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>Customer</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>

      </ejb-relation>

      B. The jbosscmp-jdbc.xml has the following descriptor:

      <ejb-relation>
      <ejb-relation-name>order-customer</ejb-relation-name>

      <foreign-key-mapping/>

      <ejb-relationship-role>
      <ejb-relationship-role-name>order-belongs_to-customer</ejb-relationship-role-name>
      <key-fields/>

      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>customer-has-orders</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>userId</field-name>
      <column-name>customer_fk</column-name>
      </key-field>
      </key-fields>

      </ejb-relationship-role>
      </ejb-relation>

      C. When the Ear file was deployed, I got the following error message:

      SQL: SELECT t0_Order.orderUId FROM T_ORDER t0_Order WHERE t0_Order.orderUId=?
      Added findByPrimaryKey query command for local home interface
      EJB-QL: SELECT OBJECT(o) FROM Order AS o WHERE o.customer.userId = ?1
      [STDOUT] org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "Order" at line 1, column 23.
      Was expecting one of:
      "IN" ...
      <ABSTRACT_SCHEMA> ...

      [STDOUT] at org.jboss.ejb.plugins.cmp.ejbql.EJBQLParser.generateParseException EJBQLParser.java:4485)

      D. Thanks in advanced.

      Ben C.