6 Replies Latest reply on Sep 1, 2004 4:50 PM by ggodoy

    Error compiling simple EJB-QL

    ssalah75 Newbie

      I've created a simple CMP, and I tried to deploy it but it fails returnning the following error


      org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT OBJECT(a)FROM SalaryGrade a WHERE ?1=hisal'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "1" at line 1, column 42.
      Was expecting one of:
      "NOT" ...
      "(" ...
      <COLLECTION_VALUED_PATH> ...
      <STRING_VALUED_PATH> ...
      "CONCAT" ...
      "SUBSTRING" ...
      <BOOLEAN_VALUED_PATH> ...
      <DATETIME_VALUED_PATH> ...
      <ENTITY_VALUED_PATH> ...
      <IDENTIFICATION_VARIABLE> ...
      <NUMERIC_VALUED_PATH> ...
      "LENGTH" ...
      "LOCATE" ...
      "ABS" ...
      "SQRT" ...
      "+" ...
      "-" ...
      <INTEGER_LITERAL> ...
      <FLOATING_POINT_LITERAL> ...
      <NUMERIC_VALUED_PARAMETER> ...
      )


      The ejb-jar.xml file is as follow:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      <ejb-jar>
      <display-name>TestModule</display-name>
      <enterprise-beans>

      <display-name>TestSessions</display-name>
      <ejb-name>TestSessions</ejb-name>
      testproj.TestSessionsHome
      testproj.TestSessions
      <local-home>testproj.TestSessionsLocalHome</local-home>
      testproj.TestSessionsLocal
      <ejb-class>testproj.TestSessionsBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>


      <display-name>TestStatefull</display-name>
      <ejb-name>TestStatefull</ejb-name>
      testproj.TestStatefullHome
      testproj.TestStatefull
      <local-home>testproj.TestStatefullLocalHome</local-home>
      testproj.TestStatefullLocal
      <ejb-class>testproj.TestStatefullBean</ejb-class>
      <session-type>Stateful</session-type>
      <transaction-type>Container</transaction-type>


      <display-name>Dept</display-name>
      <ejb-name>Dept</ejb-name>
      testproj.DeptRemoteHome
      testproj.DeptRemote
      <local-home>testproj.DeptHome</local-home>
      testproj.Dept
      <ejb-class>testproj.DeptBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.math.BigDecimal</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Dept</abstract-schema-name>
      <cmp-field>
      <field-name>deptno</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>dname</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>loc</field-name>
      </cmp-field>
      <primkey-field>deptno</primkey-field>


      <display-name>Emp</display-name>
      <ejb-name>Emp</ejb-name>
      <local-home>testproj.EmpHome</local-home>
      testproj.Emp
      <ejb-class>testproj.EmpBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.math.BigDecimal</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Emp</abstract-schema-name>
      <cmp-field>
      <field-name>comm</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>deptno</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>empno</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>ename</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>hiredate</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>job</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>mgr</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>sal</field-name>
      </cmp-field>
      <primkey-field>empno</primkey-field>


      <display-name>DeptSessionFacade</display-name>
      <ejb-name>DeptSessionFacade</ejb-name>
      testproj.DeptSessionFacadeHome
      testproj.DeptSessionFacade
      <local-home>testproj.DeptSessionFacadeLocalHome</local-home>
      testproj.DeptSessionFacadeLocal
      <ejb-class>testproj.DeptSessionFacadeBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <ejb-local-ref>
      <ejb-ref-name>ejb/dept</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>testproj.DeptHome</local-home>
      testproj.Dept
      <ejb-link>Dept</ejb-link>
      </ejb-local-ref>


      <display-name>DeptTest</display-name>
      <ejb-name>DeptTest</ejb-name>
      testproj.test.DeptTestRemoteHome
      testproj.test.DeptTestRemote
      <local-home>testproj.test.DeptTestHome</local-home>
      testproj.test.DeptTest
      <ejb-class>testproj.test.DeptTestBean</ejb-class>
      <persistence-type>Bean</persistence-type>
      <prim-key-class>java.math.BigDecimal</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>


      <display-name>Salgrade</display-name>
      <ejb-name>Salgrade</ejb-name>
      testproj.test.SalgradeRemoteHome
      testproj.test.SalgradeRemote
      <local-home>testproj.test.SalgradeHome</local-home>
      testproj.test.Salgrade
      <ejb-class>testproj.test.SalgradeBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.math.BigDecimal</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>SalaryGrade</abstract-schema-name>
      <cmp-field>
      <field-name>grade</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>hisal</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>losal</field-name>
      </cmp-field>
      <primkey-field>grade</primkey-field>

      <query-method>
      <method-name>findMaxSal</method-name>
      <method-params>
      <method-param>java.math.BigDecimal</method-param>
      </method-params>
      </query-method>
      <ejb-ql>SELECT OBJECT(a)FROM SalaryGrade a WHERE ?1=hisal </ejb-ql>


      </enterprise-beans>

      <ejb-relation>
      <ejb-relation-name>dept-emp</ejb-relation-name>
      <ejb-relationship-role>
      dept
      <ejb-relationship-role-name>DeptRelationshipRole</ejb-relationship-role-name>
      One
      <relationship-role-source>
      dept
      <ejb-name>Dept</ejb-name>
      </relationship-role-source>
      <cmr-field>
      emp
      <cmr-field-name>emp</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
      emp
      <ejb-relationship-role-name>EmpRelationshipRole</ejb-relationship-role-name>
      Many
      <relationship-role-source>
      emp
      <ejb-name>Emp</ejb-name>
      </relationship-role-source>
      <cmr-field>
      dept
      <cmr-field-name>dept</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      </ejb-relation>

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>TestSessions</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction>

      <ejb-name>TestStatefull</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction>

      <ejb-name>Dept</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction>

      <ejb-name>Emp</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction>

      <ejb-name>DeptSessionFacade</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction>

      <ejb-name>DeptTest</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction>

      <ejb-name>Salgrade</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>


      can any body tell me what's wrong with this bean.