2 Replies Latest reply on Feb 21, 2003 3:42 AM by lumin

    EJB QL problem

    lumin

      Hi everyone,

      I encountered some problems by deploying finder methods which uses BigDecimal as input parameter. Querying Strings works without problems. I also tried to warp my query within a CDATA tag, but this has no effects. I always get the following error msg:

      13:47:15,269 WARN [ServiceController] Problem starting service jboss.j2ee:jndiName=Registration,service=EJB
      org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseEx
      ception: Encountered "o.userid" at line 1, column 46.
      Was expecting one of:
      "NOT" ...
      "(" ...
      <COLLECTION_VALUED_PATH> ...
      <STRING_VALUED_PATH> ...
      "CONCAT" ...

      My ejb-jar.xml looks like this:

      <display-name>Registration</display-name>
      <ejb-name>Registration</ejb-name>
      <local-home>upgjboss.RegistrationHome</local-home>
      upgjboss.Registration
      <ejb-class>upgjboss.RegistrationBean</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>Registration</abstract-schema-name>
      <cmp-field>
      <field-name>regid</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>userid</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>ppersons</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>remark</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>valid</field-name>
      </cmp-field>
      <primkey-field>regid</primkey-field>

      <query-method>
      <method-name>findAll</method-name>
      <method-params />
      </query-method>
      <ejb-ql>SELECT Object(o) FROM Registration o</ejb-ql>


      <query-method>
      <method-name>findByRemark</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <ejb-ql>SELECT OBJECT(o) FROM Registration o WHERE o.remark = ?1</ejb-ql>


      <query-method>
      <method-name>findByUserId</method-name>
      <method-params>
      <method-param>java.math.BigDecimal</method-param>
      </method-params>
      </query-method>
      <ejb-ql>SELECT OBJECT(o) FROM Registration o WHERE o.userid = ?1</ejb-ql>



      The string query works fine but findByUserId always produces the mentioned error.
      Regards
      lumin

        • 1. Re: EJB QL problem
          lumin

          An older thread mentions, that ejb ql does not support BigDecimal values, but jb ql does. Can anybody give me a example for such a query. regards, lumin

          • 2. Re: EJB QL problem
            lumin

            I solved the problem by changing data type from BigDecimal to Integer. Regards lumin